k8s报错kubelet.go:2461] “Error getting node“ err=“node \“k8s-master\“ not found“

问题

首先最初问题:

bash 复制代码
[root@k8s-master ~]# kubectl get pods -owide --all-namespaces
The connection to the server 192.168.2.129:6443 was refused - did you specify the right host or port?

检查kubelet状态

查看kubelet status报找不到master节点

bash 复制代码
[root@k8s-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 四 2025-04-17 10:22:59 CST; 5min ago
     Docs: https://kubernetes.io/docs/
 Main PID: 1213 (kubelet)
    Tasks: 17
   Memory: 170.7M
   CGroup: /system.slice/kubelet.service
           └─1213 /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=registr...

解决办法更新k8s集群证书

bash 复制代码
[root@k8s-master ~]# sudo kubeadm  certs renew all
[renew] Reading configuration from the cluster...
[renew] FYI: You can look at this config file with 'kubectl -n kube-system get cm kubeadm-config -o yaml'

certificate embedded in the kubeconfig file for the admin to use and for kubeadm itself renewed
certificate for serving the Kubernetes API renewed
certificate the apiserver uses to access etcd renewed
certificate for the API server to connect to kubelet renewed
certificate embedded in the kubeconfig file for the controller manager to use renewed
certificate for liveness probes to healthcheck etcd renewed
certificate for etcd nodes to communicate with each other renewed
certificate for serving etcd renewed
certificate for the front proxy client renewed
certificate embedded in the kubeconfig file for the scheduler manager to use renewed

Done renewing certificates. You must restart the kube-apiserver, kube-controller-manager, kube-scheduler and etcd, so that they can use the new certificates.

成功运行

bash 复制代码
[root@k8s-master ~]# kubectl get pods
NAME                                     READY   STATUS    RESTARTS      AGE
adservice-78b57fcf87-n252v               2/2     Running   0             13m
cartservice-55777c7ffd-sh2xd             2/2     Running   0             13m
checkoutservice-f5b7689d5-j6drp          2/2     Running   0             13m
currencyservice-5c454c8b5-t92l9          2/2     Running   0             13m
emailservice-67cf544dc-x4sxj             2/2     Running   1 (12m ago)   13m
frontend-c958f56fb-qtt2d                 2/2     Running   0             13m
loadgenerator-578d9f8456-ljqnn           2/2     Running   0             13m
paymentservice-688f5649f5-57dfh          2/2     Running   0             13m
productcatalogservice-7cd48ddfc7-mp8z6   2/2     Running   0             13m
recommendationservice-7dc9f5f575-8zqkm   2/2     Running   1 (12m ago)   13m
redis-cart-849bbcb78b-6c4dw              2/2     Running   0             13m
shippingservice-56d97db699-hghmq         2/2     Running   0             13m
相关推荐
zhangfeng11332 小时前
Ollama 支持模型微调但是不支持词库,支持RAG,go语言开发的大模型的推理应用,
人工智能·深度学习·golang
Dr.Kun4 小时前
【鲲码园PsychoPy】Go/No-go范式
开发语言·后端·golang
Dontla4 小时前
Kubernetes流量管理双雄:Ingress与Gateway API解析(Nginx与Ingress与Gateway API的关系)
nginx·kubernetes·gateway
源代码•宸5 小时前
Golang面试题库(Interface、GMP)
开发语言·经验分享·后端·面试·golang·gmp·调度过程
西京刀客5 小时前
Go 语言中的 toolchain 指令-toolchain go1.23.6的作用和目的
开发语言·后端·golang·toolchain
七夜zippoe5 小时前
Kubernetes与Python微服务编排实战:从基础部署到自动扩缩容
python·微服务·kubernetes·service·hpa
Hello.Reader6 小时前
Flink CLI 从提交作业到 Savepoint/Checkpoint、再到 YARN/K8S 与 PyFlink
大数据·flink·kubernetes
暴躁小师兄数据学院6 小时前
【WEB3.0零基础转行笔记】编程语言篇-第一讲:Go语言基础及环节搭建
笔记·golang·web3·区块链
lead520lyq18 小时前
Golang本地内存缓存
开发语言·缓存·golang
小邓吖19 小时前
自己做了一个工具网站
前端·分布式·后端·中间件·架构·golang