记Kubernetes(k8s)初始化报错:“Error getting node“ err=“node \“k8s-master\“ not found“

news2024/10/5 19:11:36

记Kubernetes(k8s)初始化报错:"Error getting node" err="node \"k8s-master\" not found"

  • 1、报错详情
  • 2、问题排查
  • 3、尝试问题解决


💖The Begin💖点点关注,收藏不迷路💖

1、报错详情

"Error getting node" err="node \"k8s-master\" not found"

查看日志报错:

[root@k8s-master ~]# journalctl -u kubelet

Apr 01 21:39:47 k8s-master kubelet[9638]: E0401 21:39:47.267736    9638 kubelet.go:2419] "Error getting node" err="node \"k8s-master\" not found"
Apr 01 21:39:47 k8s-master kubelet[9638]: E0401 21:39:47.368592    9638 kubelet.go:2419] "Error getting node" err="node \"k8s-master\" not found"
Apr 01 21:39:47 k8s-master kubelet[9638]: E0401 21:39:47.469741    9638 kubelet.go:2419] "Error getting node" err="node \"k8s-master\" not found"
Apr 01 21:39:47 k8s-master kubelet[9638]: E0401 21:39:47.571557    9638 kubelet.go:2419] "Error getting node" err="node \"k8s-master\" not found"
Apr 01 21:39:47 k8s-master kubelet[9638]: E0401 21:39:47.671768    9638 kubelet.go:2419] "Error getting node" err="node \"k8s-master\" not found"
Apr 01 21:39:47 k8s-master kubelet[9638]: E0401 21:39:47.772126    9638 kubelet.go:2419] "Error getting node" err="node \"k8s-master\" not found"
Apr 01 21:39:47 k8s-master kubelet[9638]: E0401 21:39:47.872910    9638 kubelet.go:2419] "Error getting node" err="node \"k8s-master\" not found"
Apr 01 21:39:47 k8s-master kubelet[9638]: E0401 21:39:47.973850    9638 kubelet.go:2419] "Error getting node" err="node \"k8s-master\" not found"

2、问题排查

1、操作系统centos7.9,不知道是不是centos的原因,用redhat安装没报这个错

[root@k8s-master ~]# cat /etc/centos-release
CentOS Linux release 7.9.2009 (Core)
[root@k8s-master ~]# 

2、docker 版本检查

[root@k8s-master ~]# docker -v
Docker version 24.0.5, build ced0996
[root@k8s-master ~]# 

3、kubelet 版本检查

[root@k8s-master ~]# kubelet --version
Kubernetes v1.24.1
[root@k8s-master ~]# 

查找资料:

Kubernetes在v1.24版本之后正式放弃了对Docker的支持。这意味着Kubernetes的官方支持不再包括Docker作为容器运行时。相反,官方现在推荐使用Containerd或CRI-O作为容器运行时。

3、尝试问题解决

1、降级到Kubernetes的v1.23.6版本。需要卸载所有当前安装的1.24版本的kubelet、kubectl和kubeadm。

sudo yum remove kubelet kubectl kubeadm

在这里插入图片描述

2、下载并安装Kubernetes v1.23.6版本的kubelet、kubectl和kubeadm。

sudo yum install -y kubelet-1.23.6 kubeadm-1.23.6 kubectl-1.23.6 --disableexcludes=kubernetes

3、验证安装是否成功,可以运行以下命令:

kubelet --version
kubectl version --short
kubeadm version

在这里插入图片描述

4、重置本地机器上的Kubernetes集群状态

重置本地机器上的Kubernetes集群状态。将本地机器上的Kubernetes相关配置、数据和状态恢复到初始状态。

删除etcd中的所有数据。
删除所有由kubeadm创建的配置文件和系统单元文件。
恢复iptables和ipvs等网络配置。
删除CNI插件配置。

kubeadm reset

在这里插入图片描述

这个命令通常在需要清理Kubernetes集群环境、重新初始化集群或者彻底卸载Kubernetes时使用。执行kubeadm reset命令后,可以重新初始化一个全新的Kubernetes集群。

要不会报错:

[init] Using Kubernetes version: v1.23.6
[preflight] Running pre-flight checks
error execution phase preflight: [preflight] Some fatal errors occurred:
	[ERROR Port-6443]: Port 6443 is in use
	[ERROR Port-10259]: Port 10259 is in use
	[ERROR Port-10257]: Port 10257 is in use
	[ERROR FileAvailable--etc-kubernetes-manifests-kube-apiserver.yaml]: /etc/kubernetes/manifests/kube-apiserver.yaml already exists
	[ERROR FileAvailable--etc-kubernetes-manifests-kube-controller-manager.yaml]: /etc/kubernetes/manifests/kube-controller-manager.yaml already exists
	[ERROR FileAvailable--etc-kubernetes-manifests-kube-scheduler.yaml]: /etc/kubernetes/manifests/kube-scheduler.yaml already exists
	[ERROR FileAvailable--etc-kubernetes-manifests-etcd.yaml]: /etc/kubernetes/manifests/etcd.yaml already exists
	[ERROR Port-10250]: Port 10250 is in use
	[ERROR Port-2379]: Port 2379 is in use
	[ERROR Port-2380]: Port 2380 is in use
	[ERROR DirAvailable--var-lib-etcd]: /var/lib/etcd is not empty
[preflight] If you know what you are doing, you can make a check non-fatal with `--ignore-preflight-errors=...`
To see the stack trace of this error execute with --v=5 or higher

5、再次初始化,指定Kubernetes的版本为v1.23.6。重新初始化一个全新的Kubernetes集群。

kubeadm init \
  --apiserver-advertise-address=192.168.234.20 \
  --control-plane-endpoint=k8s-master \
  --image-repository registry.aliyuncs.com/google_containers \
  --kubernetes-version v1.23.6 \
  --service-cidr=10.11.0.0/16 \
  --pod-network-cidr=172.30.0.0/16 \
  --cri-socket unix:///var/run/cri-dockerd.sock

在这里插入图片描述

————————————问题解决,初始化成功——————————

[root@k8s-master ~]# kubeadm init \
>   --apiserver-advertise-address=192.168.234.20 \
>   --control-plane-endpoint=k8s-master \
>   --image-repository registry.aliyuncs.com/google_containers \
>   --kubernetes-version v1.23.6 \
>   --service-cidr=10.11.0.0/16 \
>   --pod-network-cidr=172.30.0.0/16 \
>   --cri-socket unix:///var/run/cri-dockerd.sock
[init] Using Kubernetes version: v1.23.6
[preflight] Running pre-flight checks
[preflight] Pulling images required for setting up a Kubernetes cluster
[preflight] This might take a minute or two, depending on the speed of your internet connection
[preflight] You can also perform this action in beforehand using 'kubeadm config images pull'
[certs] Using certificateDir folder "/etc/kubernetes/pki"
[certs] Generating "ca" certificate and key
[certs] Generating "apiserver" certificate and key
[certs] apiserver serving cert is signed for DNS names [k8s-master kubernetes kubernetes.default kubernetes.default.svc kubernetes.default.svc.cluster.local] and IPs [10.11.0.1 192.168.234.20]
[certs] Generating "apiserver-kubelet-client" certificate and key
[certs] Generating "front-proxy-ca" certificate and key
[certs] Generating "front-proxy-client" certificate and key
[certs] Generating "etcd/ca" certificate and key
[certs] Generating "etcd/server" certificate and key
[certs] etcd/server serving cert is signed for DNS names [k8s-master localhost] and IPs [192.168.234.20 127.0.0.1 ::1]
[certs] Generating "etcd/peer" certificate and key
[certs] etcd/peer serving cert is signed for DNS names [k8s-master localhost] and IPs [192.168.234.20 127.0.0.1 ::1]
[certs] Generating "etcd/healthcheck-client" certificate and key
[certs] Generating "apiserver-etcd-client" certificate and key
[certs] Generating "sa" key and public key
[kubeconfig] Using kubeconfig folder "/etc/kubernetes"
[kubeconfig] Writing "admin.conf" kubeconfig file
[kubeconfig] Writing "kubelet.conf" kubeconfig file
[kubeconfig] Writing "controller-manager.conf" kubeconfig file
[kubeconfig] Writing "scheduler.conf" kubeconfig file
[kubelet-start] Writing kubelet environment file with flags to file "/var/lib/kubelet/kubeadm-flags.env"
[kubelet-start] Writing kubelet configuration to file "/var/lib/kubelet/config.yaml"
[kubelet-start] Starting the kubelet
[control-plane] Using manifest folder "/etc/kubernetes/manifests"
[control-plane] Creating static Pod manifest for "kube-apiserver"
[control-plane] Creating static Pod manifest for "kube-controller-manager"
[control-plane] Creating static Pod manifest for "kube-scheduler"
[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
[apiclient] All control plane components are healthy after 5.003345 seconds
[upload-config] Storing the configuration used in ConfigMap "kubeadm-config" in the "kube-system" Namespace
[kubelet] Creating a ConfigMap "kubelet-config-1.23" in namespace kube-system with the configuration for the kubelets in the cluster
NOTE: The "kubelet-config-1.23" naming of the kubelet ConfigMap is deprecated. Once the UnversionedKubeletConfigMap feature gate graduates to Beta the default name will become just "kubelet-config". Kubeadm upgrade will handle this transition transparently.
[upload-certs] Skipping phase. Please see --upload-certs
[mark-control-plane] Marking the node k8s-master as control-plane by adding the labels: [node-role.kubernetes.io/master(deprecated) node-role.kubernetes.io/control-plane node.kubernetes.io/exclude-from-external-load-balancers]
[mark-control-plane] Marking the node k8s-master as control-plane by adding the taints [node-role.kubernetes.io/master:NoSchedule]
[bootstrap-token] Using token: lad5yi.ib6gterchvmkw2xd
[bootstrap-token] Configuring bootstrap tokens, cluster-info ConfigMap, RBAC Roles
[bootstrap-token] configured RBAC rules to allow Node Bootstrap tokens to get nodes
[bootstrap-token] configured RBAC rules to allow Node Bootstrap tokens to post CSRs in order for nodes to get long term certificate credentials
[bootstrap-token] configured RBAC rules to allow the csrapprover controller automatically approve CSRs from a Node Bootstrap Token
[bootstrap-token] configured RBAC rules to allow certificate rotation for all node client certificates in the cluster
[bootstrap-token] Creating the "cluster-info" ConfigMap in the "kube-public" namespace
[kubelet-finalize] Updating "/etc/kubernetes/kubelet.conf" to point to a rotatable kubelet client certificate and key
[addons] Applied essential addon: CoreDNS
[addons] Applied essential addon: kube-proxy

Your Kubernetes control-plane has initialized successfully!

To start using your cluster, you need to run the following as a regular user:

  mkdir -p $HOME/.kube
  sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
  sudo chown $(id -u):$(id -g) $HOME/.kube/config

Alternatively, if you are the root user, you can run:

  export KUBECONFIG=/etc/kubernetes/admin.conf

You should now deploy a pod network to the cluster.
Run "kubectl apply -f [podnetwork].yaml" with one of the options listed at:
  https://kubernetes.io/docs/concepts/cluster-administration/addons/

You can now join any number of control-plane nodes by copying certificate authorities
and service account keys on each node and then running the following as root:

  kubeadm join k8s-master:6443 --token lad5yi.ib6gterchvmkw2xd \
	--discovery-token-ca-cert-hash sha256:eb567a446cd6a0d79da694f4ab23b5c7bf2be4df86f4aecfadef07716fbabd2b \
	--control-plane 

Then you can join any number of worker nodes by running the following on each as root:

kubeadm join k8s-master:6443 --token lad5yi.ib6gterchvmkw2xd \
	--discovery-token-ca-cert-hash sha256:eb567a446cd6a0d79da694f4ab23b5c7bf2be4df86f4aecfadef07716fbabd2b 
[root@k8s-master ~]# 

在这里插入图片描述


💖The End💖点点关注,收藏不迷路💖

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/1561454.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

2003-2022年分国家、分行业、各省对外直接投资流量/存量/OFDI流量/OFDI存量(三份数据合集)

2003-2022年分国家、分行业、各省对外直接投资流量/存量/OFDI流量/OFDI存量 1、时间:更新至2022年,具体时间如下: 2003-2022年各省对外直接投资存量、省对外直接投资流量、省OFDI流量、省OFDI存量数据 2003-2022年中国对外直接投资流量、O…

halcon图像膨胀

1、原理: 使用结构元素在图像上移动,如果结构元素中有任意一个像素和图像上的非零像素重叠,则保留此时结构元素中心所在位置,并将其像素值设置为非零。 2、halcon代码 其中圆形结构元素可设置半径,矩形结构元素设置…

书生·浦语大模型第二期实战营(2)笔记作业

大模型部署 链接: 文档 链接: internstudio 1.部署 InternLM2-Chat-1.8B 模型进行智能对话 2.部署实战营优秀作品 八戒-Chat-1.8B 模型 3.通过 InternLM2-Chat-7B 运行 Lagent 智能体 Demo 4.实践部署 浦语灵笔2 模型 5.熟悉 huggingface 下载功能 from huggingface_hub im…

微信小程序使用textarea默认字数限制以及高度自适应和默认高度设置

<textarea model:value"{{text}}" auto-height placeholder"请输入内容" maxlength"-1" /> auto-height 设置自适应高度 设置之后高度设置无效 maxlength"-1" 解决默认最大字数限制 css // 文本域 textarea { border:…

【软考】系统集成项目管理工程师(二十二)法律法规【2分】

一、合同法 1、内容 当事人的名称或者姓名和住所、标的、数量、质量、价款或者报酬&#xff1b;履行期限、地点和方式&#xff1b;违约责任和解决争议的方法 练一练 【例1-高16下】格式条款是当事人为了重复使用而预先拟定&#xff0c;并在订立合同时未与对方协商的…

Python入门(八)

引入 引入函数 为了减少代码的冗余&#xff0c;减轻我们的工作量&#xff0c;我们常常将代码分块编写&#xff0c;在Python中更是如此&#xff0c;那么我们怎么在一个新的程序文件中调用我们已经编写好程序文件的函数&#xff0c;我们使用import。我们先写一个first.py为例语…

5G PLMN相关概念

PLMN PLMN&#xff08;Public Land Mobile Network&#xff0c;公用陆地移动网络&#xff09;&#xff0c;是由政府或其批准的经营者为公众提供陆地移动通信业务而建立、经营的网络。PLMN与公众交换电话网&#xff08;PSTN&#xff09;互连&#xff0c;形成整个地区或国家规模…

Verilog基础【二】

3.1 Verilog 连续赋值 关键词&#xff1a;assign&#xff0c; 全加器 连续赋值语句是 Verilog 数据流建模的基本语句&#xff0c;用于对 wire 型变量进行赋值。&#xff1a; assign LHS_target RHS_expression &#xff1b;LHS&#xff08;left hand side&#xff09;…

java中:print与println的区别

目录 区别 区别 print是直接打印输出 println是输出后自动回车到下一行 例如 public class test {public static void main(String[] args){System.out.println("换行");System.out.print("不换行");System.out.println();}}——————————————…

STL容器的一些操作(常用的,不全)

目录 string 1.string的一些创建 2.string 的读入和输出&#xff1a; 3.string的一些操作 4.彻底清空string 容器的函数 vector 1.vector的一些创建&#xff1a; 2.vector的一些操作&#xff1a; 3.vector的彻底清空并释放内存&#xff1a; queue 循环队列&#xff1…

Mysql数据备份与恢复实战

文章目录 备份类型备份内容备份工具mysqldump备份 实战案例&#xff1a;恢复误删除的表准备工作2:30完全备份完全备份后更新数据表10:00误删students表需要恢复还原的状态开始还原恢复 为什么要备份&#xff1f; 备份是为了&#xff1a;灾难恢复&#xff1a;硬件故障、软件故障…

维安电子、费斯托中国等20+智能制造企业共探渠道管理数字化

近日&#xff0c;纷享销客新增长100人系列活动之制造业专场&#xff0c;我们有幸邀请维安电子、费斯托工具一起&#xff0c;共同探讨制造业渠道管理的新理念、新增长和新实践。 活动聚集了维安电子、费斯托工具、唐纳森、中科新松、斯可络、江浪科技、上海沪工等等20余位标杆制…

算法学习——LeetCode力扣动态规划篇9(1035. 不相交的线、53. 最大子数组和、392. 判断子序列、115. 不同的子序列)

算法学习——LeetCode力扣动态规划篇9 1035. 不相交的线 1035. 不相交的线 - 力扣&#xff08;LeetCode&#xff09; 描述 在两条独立的水平线上按给定的顺序写下 nums1 和 nums2 中的整数。 现在&#xff0c;可以绘制一些连接两个数字 nums1[i] 和 nums2[j] 的直线&#x…

针对 qt的sqlite加密数据库sqlitecipher插件QtCipherSqlitePlugin

&#x1f482; 个人主页:pp不会算法^ v ^ &#x1f91f; 版权: 本文由【pp不会算法v】原创、在CSDN首发、需要转载请联系博主 &#x1f4ac; 如果文章对你有帮助、欢迎关注、点赞、收藏(一键三连)和订阅专栏哦 文章目录 简介编译安装使用可视化工具查看完结 简介 在客户端存储…

【docker】基础操作命令

docker run:干两步&#xff0c;本地找一下有没有集装箱&#xff0c;有运行&#xff0c;没有远程仓库下载运行。还没有报错。 docker好处&#xff1a; 不需要进行物理层模拟&#xff0c;不需要hypervisor利用的内核是宿主机的内核&#xff0c;不需要重新加载Linux内核 镜像相关…

QT-飞机水平仪图标

QT-飞机水平仪图标 一、演示效果二、关键程序三、下载链接 一、演示效果 二、关键程序 #include <stdio.h> #include <stdlib.h> #include <string.h>#include <QtCore> #include <QtGui> #include <QDebug> #include <QTableWidget&g…

刷题之动态规划-路径问题

前言 大家好&#xff0c;我是jiantaoyab&#xff0c;开始刷动态规划的题目了&#xff0c;要特别注意初始化的时候给什么值。 动态规划5个步骤 状态表示 &#xff1a;dp数组中每一个下标对应值的含义是什么->dp[i]表示什么状态转移方程&#xff1a; dp[i] 等于什么1 和 2 是…

python毕业设计django宠物寄存系统fn62p

本文所设计的宠物寄存中心系统的设计与实现拥有前端和后端&#xff0c;前端使用Vue.js框架和创建&#xff0c;后端使用django框架创建&#xff0c;开发语言采用python&#xff0c;使用Mysql数据库对后台数据进行存储。将pcyahrm作为主要的开发工具。接着进行系统的需求分析、功…

surfer绘制等值线图

surfer介绍 Surfer软件&#xff0c;是美国Golden Software公司编制的一款以画三维图的软件。该软件具有强大的插值功能和绘制图件能力&#xff0c;可用来处理XYZ数据&#xff0c;是地质工作者常用的专业成图软件&#xff08;来源于百度百科&#xff09;。 surfer可以用来绘制…

Linux文件与进程交互的窥探者lsof

lsof 是一个 Linux 和 UNIX 系统中的实用工具,用于列出系统中打开文件的所有信息。这个名字代表 “List Open Files”,但它也可以显示进程相关的其他信息,如: 打开的文件描述符列表 打开网络连接的列表 被进程使用的信号和内核对象等 在Linux系统中,有一个经典的概念: …