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

问题

首先最初问题:

[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节点

[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集群证书

[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.

成功运行

[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
### 解决 Kubernetes 节点 'k8s-master1' 找不到的问题 当遇到 `Kubernetes node 'k8s-master1' not found` 的错误时,这通常意味着该节点未能成功加入集群或已从集群中移除。以下是几种可能的原因及解决方案: #### 1. 检查节点状态 确认 `k8s-master1` 是否确实存在于集群内并处于正常工作状态。可以使用命令来查看所有节点的状态: ```bash kubectl get nodes ``` 如果未看到 `k8s-master1` 或其状态异常,则需进一步排查。 #### 2. 查看事件日志 通过查询最近发生的事件可以帮助定位问题所在: ```bash kubectl describe node k8s-master1 ``` 此操作会显示有关指定节点的详细信息以及任何潜在警告或错误消息[^1]。 #### 3. 网络配置验证 确保网络设置正确无误,特别是对于多主机环境而言非常重要。检查是否由于 DNS 配置不当或其他网络连接问题导致无法识别新添加的节点。必要时调整 Ingress 设置中的域名映射关系[^2]。 #### 4. 内存资源不足 有时也会因为物理机内存不够而影响到容器调度和服务启动,进而造成节点不可见的情况发生。注意观察是否有类似 "Unable to allocate memory on node" 这样的提示,并采取相应措施释放更多可用RAM空间给Kubernetes使用[^3]。 #### 5. 组件部署位置校验 考虑到某些组件仅限于特定类型的节点上运行(比如 Master),所以要核实像 Contiv-VPP 这样依赖特殊硬件支持的服务有没有被错误地分配到了不合适的机器上面去执行[^4]。 #### 6. 初始化参数复查 最后还要仔细核对 etcd 初始聚类成员列表里是否包含了当前尝试接入的新节点地址;如果不匹配的话就需要更新相应的 YAML 文件以反映最新的拓扑结构变化情况[^5]。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值