首页 > 编程语言 >kubelet.go 2466 Error getting node not found

kubelet.go 2466 Error getting node not found

时间:2023-10-05 10:44:06浏览次数:47  
标签:node 2466 17 getting kubelet master 80133 k8s3

kubeadm初始化kubernetes集群报错,kubelet服务提示:kubelet.go:2466] "Error getting node" err="node \"k8s3-master\" not found处理记录。

 

 

0. ENV

 

kubernetes 1.22.x/1.23.x/1.24.x(不限于所列版本)

CentOS 7.x/Ubuntu 22.04(不限于所列版本)

 

 

1. 问题现象

 

kubeadm初始化master失败

[root@k8s3-master ~]# kubeadm init --apiserver-advertise-address=192.168.90.125 --image-repository registry.aliyuncs.com/google_containers --kubernetes-version v1.23.8 --service-cidr=10.96.0.0/12 --pod-network-cidr=10.244.0.0/16
[init] Using Kubernetes version: v1.23.8
[preflight] Running pre-flight checks
...
[etcd] Creating static Pod manifest for local etcd in "/etc/kubernetes/manifests"
[wait-control-plane] Waiting for the kubelet to boot up the control plane as static Pods from directory "/etc/kubernetes/manifests". This can take up to 4m0s
[kubelet-check] Initial timeout of 40s passed. #执行超过40s


Unfortunately, an error has occurred:
timed out waiting for the condition


This error is likely caused by:
- The kubelet is not running
- The kubelet is unhealthy due to a misconfiguration of the node in some way (required cgroups disabled)


If you are on a systemd-powered system, you can try to troubleshoot the error with the following commands:
- 'systemctl status kubelet'
- 'journalctl -xeu kubelet'


Additionally, a control plane component may have crashed or exited when started by the container runtime.
To troubleshoot, list all containers using your preferred container runtimes CLI.


Here is one example how you may list all Kubernetes containers running in docker:
- 'docker ps -a | grep kube | grep -v pause'
Once you have found the failing container, you can inspect its logs with:
- 'docker logs CONTAINERID'


error execution phase wait-control-plane: couldn't initialize a Kubernetes cluster #初始化失败
To see the stack trace of this error execute with --v=5 or higher

 

 

2. 分析

 

根据提示查看kubelet服务

[root@k8s3-master ~]# systemctl status kubelet
● kubelet.service - kubelet: The Kubernetes Node Agent
Loaded: loaded (/usr/lib/systemd/system/kubelet.service; enabled; vendor preset: disabled)
Drop-In: usr/lib/systemd/system/kubelet.service.d
└─10-kubeadm.conf
Active: active (running) since Wed 2022-07-06 17:27:00 CST; 49s ago
Docs: https://kubernetes.io/docs/
Main PID: 80133 (kubelet)
Tasks: 26
Memory: 32.1M
CGroup: system.slice/kubelet.service
└─80133 usr/bin/kubelet --bootstrap-kubeconfig=/etc/kubernetes/bootstrap-kubelet.conf --kubeconfig=/etc/kubernetes/kubelet.conf --config=/var/lib/kubelet/config.yaml --network-plugin=cni --pod-infra-container-image=regist...


Jul 06 17:27:49 k8s3-master kubelet[80133]: E0706 17:27:49.660120 80133 kubelet.go:2466] "Error getting node" err="node \"k8s3-master\" not found"
Jul 06 17:27:49 k8s3-master kubelet[80133]: E0706 17:27:49.760811 80133 kubelet.go:2466] "Error getting node" err="node \"k8s3-master\" not found"
Jul 06 17:27:49 k8s3-master kubelet[80133]: E0706 17:27:49.861505 80133 kubelet.go:2466] "Error getting node" err="node \"k8s3-master\" not found"
Jul 06 17:27:49 k8s3-master kubelet[80133]: I0706 17:27:49.957202 80133 kubelet_node_status.go:70] "Attempting to register node" node="k8s3-master"
Jul 06 17:27:49 k8s3-master kubelet[80133]: E0706 17:27:49.962534 80133 kubelet.go:2466] "Error getting node" err="node \"k8s3-master\" not found"
Jul 06 17:27:49 k8s3-master kubelet[80133]: E0706 17:27:49.998194 80133 kubelet_node_status.go:92] "Unable to register node with API server" err="Post \"https://192.168.90.125:6443/api/v1/nodes\": dial tcp 192.168....ode="k8s3-master"
Jul 06 17:27:50 k8s3-master kubelet[80133]: E0706 17:27:50.063267 80133 kubelet.go:2466] "Error getting node" err="node \"k8s3-master\" not found"
Jul 06 17:27:50 k8s3-master kubelet[80133]: E0706 17:27:50.163691 80133 kubelet.go:2466] "Error getting node" err="node \"k8s3-master\" not found"
Jul 06 17:27:50 k8s3-master kubelet[80133]: E0706 17:27:50.264587 80133 kubelet.go:2466] "Error getting node" err="node \"k8s3-master\" not found"
Jul 06 17:27:50 k8s3-master kubelet[80133]: E0706 17:27:50.365572 80133 kubelet.go:2466] "Error getting node" err="node \"k8s3-master\" not found"

服务虽然已经启动,但有报错,提示节点k8s3-master不能发现。

 

 

3. 进一步查看主机名配置

 

1) 查看当前主机名为k8s3-master

[root@k8s3-master ~]# hostname
k8s3-master

 

2) hostname文件中显示为k8s3-master无误

[root@k8s3-master ~]# cat etc/hostname 
k8s3-master

 

3) etc/hosts中显示无误

[root@k8s3-master ~]# cat etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6


192.168.80.125 k8s3-master
192.168.80.126 k8s3-node1
192.168.80.127 k8s3-node2

当前确认主机名和对应IP无误,如果不正确,请及时更正。

 

 

4. 重置kubeadm并重新加载kubelet服务

 

当前master节点重置kubeadm

[root@k8s3-master ~]# kubeadm reset -f

 

重新加载kubelet服务

systemctl daemon-reload && systemctl restart kubelet && systemctl status kubelet

 

 

5. 因疏忽所在的问题原因-问题解决

 

最后发现kubeadm初始化IP地址写错,将错误的192.168.90.125更正为192.168.80.125,再次初始化成功。

[root@k8s3-master ~]# kubeadm init --apiserver-advertise-address=192.168.80.125 --image-repository registry.aliyuncs.com/google_containers --kubernetes-version v1.23.8 --service-cidr=10.96.0.0/12 --pod-network-cidr=10.244.0.0/16 --v=5
...
Your Kubernetes control-plane has initialized successfully!
...

 

 

6. 小结

 

kubeadm初始化master时,kubelet提示主机名未发现,需要确定主机名配置、hosts中(或DNS)的主机名解析是否匹配,另外还需要确认kubeadm init中IP正确,kubeadm使用配置文件初始化时,也需要核实配置文件中IP和主机名是否正确。

配置文件中初始化参考:

  advertiseAddress: 192.168.80.125  #1. 更改为master ip
bindPort: 6443
nodeRegistration:
criSocket: unix:///var/run/containerd/containerd.sock
imagePullPolicy: IfNotPresent
name: master1 #2. 更改为master主机名
 

标签:node,2466,17,getting,kubelet,master,80133,k8s3
From: https://www.cnblogs.com/gongxianjin/p/17743145.html

相关文章

  • Sentinel系列之SlotChain、NodeSelectorSlot、ClusterBuilderSlot分析
    本文基于Sentinel1.8.6版本分析1.SlotChain我们从入口com.alibaba.csp.sentinel.SphU#entry(java.lang.String)开始分析。一路走读下来,会进入到这个方法com.alibaba.csp.sentinel.CtSph#lookProcessChain,查找该资源对应的SlotChain。接下来看如何构建这个SlotChain.Se......
  • "Caused by: java.nio.file.AccessDeniedException: /usr/share/elasticsearch/data/n
    docker-compose搭建elasticsearch出现问题例子如下version:'3'services:elasticsearch:image:elasticsearch:7.14.0container_name:elasticsearchenvironment:-"discovery.type=single-node"-"xpack.sec......
  • Module build failed (from ./node_modules/css-loader/dist/cjs.js): CssSyntaxError
    问题描述在webpack的时候报错ERRORin./packages/theme-chalk/mixins/mixins.scss(./node_modules/css-loader/dist/cjs.js!./packages/theme-chalk/mixins/mixins.scss)Modulebuildfailed(from./node_modules/css-loader/dist/cjs.js):CssSyntaxError(14:8)......
  • nvm 安装与使用(实现Nodejs版本切换,及找不到npm的问题)
    https://blog.csdn.net/sxk1101/article/details/129208573除文章操作,别忘记把 nvm安装与使用(实现Nodejs版本切换,及找不到npm的问题)......
  • 运维 | 如何使用 nvm 安装和管理 nodeJS 版本
    运维|如何使用nvm安装和管理nodeJS版本简介NVM是什么nvm(NodeVersionManager)是NodeJS版本管理器,可对不同的node版本快速进行切换。为什么要用NVM基于node的工具和项目越来越多,但是每个项目使用的node版本可能不一致,就会出现一些奇怪的问题。比如:自己电脑......
  • Node.js:构建高效、可扩展的后端应用的利器
    ......
  • 02_nodejs开发环境安装
    02【nodejs开发环境安装】1.版本介绍在命令窗口中输入node-v可以查看版本0.x完全不技术ES64.x部分支持ES6特性5.x部分支持ES6特性(比4.x多些),属于过渡产品,现在来说应该没有什么理由去用这个了6.x支持98%的ES6特性8.x支持ES6特性2.Node.js运行环境配置:通过Node.js......
  • 03_nodejd_npm install报错
    npminstall报错npmERR!codeERESOLVEnpmERR!ERESOLVEunabletoresolvedependencytreenpmERR!npmERR!Whileresolving:[email protected]!Found:[email protected]!node_modules/vuenpmERR!vue@"2.5.17"fromtherootprojectnpmERR!......
  • 01_nodejs简介
    01【nodejs简介】1.前言Node的重要性已经不言而喻,很多互联网公司都已经有大量的高性能系统运行在Node之上。Node凭借其单线程、异步等举措实现了极高的性能基准。此外,目前最为流行的Web开发模式是前后端分离的形式,即前端开发者与后端开发者在自己喜欢的IDE上独立进行开发,......
  • 本地环境安装了node.js,vscode运行js代码出现乱码
    本地环境安装了node.js,vscode运行js代码出现乱码问题描述—vscode运行js代码出现乱码报错信息:问题原因node.js的下载安排了,环境变量vscode没有识别导致的乱码解决方法安装Node.js,软件会自动将其配置到环境变量中,然后重启VScode,最后便可以成功显示了。这个时候只有重新启动vscode就......