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

记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

[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-proxyYour Kubernetes control-plane has initialized successfully!To start using your cluster, you need to run the following as a regular user:mkdir -p $HOME/.kubesudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/configsudo chown $(id -u):$(id -g) $HOME/.kube/configAlternatively, if you are the root user, you can run:export KUBECONFIG=/etc/kubernetes/admin.confYou 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.mzph.cn/news/793716.shtml

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

相关文章

14.信号量

一、信号量的简介 信号量是一种解决同步问题的机制,可以实现对共享资源的有序访问。其中,“同步”指的 是任务间的同步,即信号量可以使得一个任务等待另一个任务完成某件事情后,才继续执行; 而“有序访问”指的是对被…

如何打包一个手机软件

目录 前言: 准备工具: 创建项目: 打包程序: 前言: 我们平时手机上使用的程序,或者电脑上使用的程序都可以由Web程序打包而来的,而打包不是一个.html文件也不是一个.js文件而是一个大型的文…

计算机网络——数据链路层(流量传输与可靠传输机制)

计算机网络——数据链路层(流量传输与可靠传输机制) 流量传输与可靠传输机制流量控制可靠传输机制 停止-等待协议无差错情况接收并检测到差错状态确认丢失或迟到状态 停等协议的效率分析后退N帧协议(Go-Back-N,简称GBN&#xff09…

【HarmonyOS】ArkUI - 动画

利用属性动画、显示动画、组件转场动画实现组件动画效果。 一、属性动画 属性动画是通过设置组件的 animation 属性来给组件添加动画,当组件的 width、height、Opacity、backgroundColor、scale、rotate、translate 等属性变更时,可以实现渐变过渡效果。…

AI Kimi:帮助教师做好试卷命题

原文:https://www.toutiao.com/article/7353661304307778083/?log_fromcfd0a50014034_1712243146922 最近,Kimichat工具很火。这款软件不仅仅是一个聊天和阅读工具,还是一个强大的教学辅助工具。作为一位教师,尝试使用Kimichat&…

101. 对称二叉树及同类题

101. 对称二叉树 力扣题目链接(opens new window) 给定一个二叉树,检查它是否是镜像对称的。 递归 /*** Definition for a binary tree node.* public class TreeNode {* int val;* TreeNode left;* TreeNode right;* TreeNode() {}* TreeNo…

开源推荐榜【Pear Admin Flask 用python来创建后台管理系统】

最新技术高效快速开发,前后端分离模式,开箱即用。 核心模块包括:用户、角色、职位、组织机构、菜单、字典、日志、多应用管理、文件管理、定时任务等功能。 代码量少、学习简单、功能强大、轻量级、易扩展,轻松开发从现在开始&…

一个线程池的理解

最近看到一个线程池,写的实在太好,于是想深入理解一下。原始代码出处:GitHub - Ahajha/CTPL: Modern and efficient C Thread Pool Library 由于平时的工程一般只支持到C11,而拿到的代码应该是在C20下才能编译通过,因此也做了一些…

第二十三章 Git

一、Git Git 是一个开源的分布式版本控制系统,用于敏捷高效地处理任何或小或大的项目。 Git 是 Linus Torvalds 为了帮助管理 Linux 内核开发而开发的一个开放源码的版本控制软件。 Git 与常用的版本控制工具 CVS, Subversion 等不同,它采用了分布式版…

MIT6.828实验:Xv6 and Unix utilities

2023MIT6.828 lab-1 官方地址 一、sleep 实验内容 调用sleep(系统调用)编写用户级别程序能暂停特定时常的系统滴答程序保存在user/sleep.c 实验过程 xv6的参数传递 查看官方文档提示的文件中,多采用如下定义: int main(in…

【网站项目】三省学堂-学习辅助系统

🙊作者简介:拥有多年开发工作经验,分享技术代码帮助学生学习,独立完成自己的项目或者毕业设计。 代码可以私聊博主获取。🌹赠送计算机毕业设计600个选题excel文件,帮助大学选题。赠送开题报告模板&#xff…

Redis中的Sentinel(一)

Sentinel 概述 Sentinel(哨岗、哨兵)是Redis的高可用性(high availability)解决方案:由一个或多个Sentinel实例(instance)组成的Sentinel系统(system)可以监视任意多个主服务器,以及这些主服务器属下的所有从服务器,并在被监视的主服务器进入下线状态时&#xff0…

JAVA毕业设计133—基于Java+Springboot+Vue的网上宠物店商城管理系统(源代码+数据库+12000字论文)

毕设所有选题: https://blog.csdn.net/2303_76227485/article/details/131104075 基于JavaSpringbootVue的网上宠物店商城管理系统(源代码数据库12000字论文)133 一、系统介绍 本项目前后端分离,分为管理员、用户两种角色 1、用户: 注册…

python-基础篇-字符串、列表、元祖、字典-字符串

文章目录 2.3字符串、列表、元祖、字典2.3.1字符串2.3.1.1字符串介绍2.3.1.1.1python中字符串的格式:2.3.1.1.2字符串在内存中的存储方式 2.3.1.2字符串的输入输出2.3.1.2.1字符串输出2.3.1.2.2字符串输入2.3.1.2.3组字符串的方式 2.3.1.3下标和切片2.3.1.3.1下标索…

Android 系统大致启动流程

Android启动流程大体为:BootRom -> BootLoader -> Kernel -> Init -> Zygote -> SystemServer ->Launcher 1、Loader层 1.1、Boot ROM 电源按下,引导芯片代码开始从预定义的地方(固化在ROM)开始执行&#xff0…

Unity入门

Unity入门学习 知识概述: Unity环境搭建 1.Unity引擎是什么 2.软件下载安装 下载最新的长期支持版即可 3.新工程和工程文件夹 Unity界面基础 1.Scene场景和Hierachy层级窗口 练习: 2.Game游戏和Project工程 3.Inspector检查和Console控制台 练习&#…

医疗器械5G智能制造工厂数字孪生可视化平台,推进行业数字化转型

医疗设备5G智能制造工厂数字孪生可视化平台,推进行业数字化转型。在数字化浪潮的推动下,医疗设备行业正迎来一场深刻的变革。5G技术的崛起,智能制造工厂的兴起,以及数字孪生可视化平台的出现,正在共同推动医疗设备行业…

Xshell Plus 详细安装教程以及附带使用图文教程

一、下载 Xshell Plus 6 完成后,请按照下面教程操作 1、下载 Xshell Plus 6 完成后,并解压 zip 包: 2、进入解压后的文件夹后,如果你之前安装了 Xshell, 先点击 !卸载.bat 卸载 xshell, 然后再点击 !绿化.bat; 如果是…

二分答案(砍树,借教室)

二分的两种情况附代码&#xff1a; 二分查找条件&#xff1a;单调&#xff0c;二段性 例题1&#xff1a;P1873 [COCI 2011/2012 #5] EKO / 砍树 - 洛谷 | 计算机科学教育新生态 (luogu.com.cn) 上代码&#xff1a; #include<bits/stdc.h> using namespace std; const …