LAB-17:集群故障排查

LAB-17:集群故障排查

LAB 概述

一个名为 k8s-node-0 的节点状态为 NotReady,让其他恢复至正常状态,并确认所有的更改开机自动完成

 LAB 预配

# 预配关闭 k8s-node-3 节点的 kubelet
# 查看 kubelet 状态
user1@k8s-node-3:~$ systemctl status kubelet.service 
● kubelet.service - kubelet: The Kubernetes Node Agent
   Loaded: loaded (/lib/systemd/system/kubelet.service; enabled; vendor preset: enabled)
  Drop-In: /etc/systemd/system/kubelet.service.d
           └─10-kubeadm.conf
   Active: active (running) since Tue 2022-05-03 11:19:51 CST; 5h 34min ago
     Docs: https://kubernetes.io/docs/home/

# 关闭 kubelet 
user1@k8s-node-3:~$ sudo systemctl stop kubelet.service

# 查看节点状态
user1@k8s-master:~$ kubectl get nodes
NAME         STATUS                     ROLES                  AGE   VERSION
k8s-master   Ready                      control-plane,master   38d   v1.22.2
k8s-node-1   Ready,SchedulingDisabled   <none>                 38d   v1.22.1
k8s-node-2   Ready                      <none>                 38d   v1.22.1
k8s-node-3   NotReady                   <none>                 38d   v1.22.1

 LAB 答案

# 切换 content
$ kubectl config use-context k8s

# 查看节点状态
$ kubectl get nodes

# 登录到node节点
$ ssh k8s-node-3

# 查看服务状态
$ sudo systemctl status kubelet
$ sudo systemctl start kubelet
$ sudo systemctl enable kubelet
$ exit

 LAB 验证

#确认 k8s-node-3 状态是否已经为 Ready
user1@k8s-master:~$ kubectl get nodes
NAME         STATUS                     ROLES                  AGE   VERSION
k8s-master   Ready                      control-plane,master   38d   v1.22.2
k8s-node-1   Ready,SchedulingDisabled   <none>                 38d   v1.22.1
k8s-node-2   Ready                      <none>                 38d   v1.22.1
k8s-node-3   Ready                      <none>                 38d   v1.22.1

 参考资料

posted @ 2022-11-22 13:54  武装小灰灰  阅读(71)  评论(0编辑  收藏  举报