1.k8s集群安装后节点notReady

现象:
在这里插入图片描述
执行命令查看问题:
1. kubectl describe node maste
在这里插入图片描述
2.journalctl -f -u kubelet
在这里插入图片描述

错误信息:

5月 18 10:12:30 master kubelet[1458]: E0518 10:12:30.373650    1458 kubelet.go:2386] "Container runtime network not ready" networkReady="NetworkReady=false reason:NetworkPluginNotReady message:docker: network plugin is not ready: cni config uninitialized"
5月 18 10:12:31 master kubelet[1458]: I0518 10:12:31.649374    1458 cni.go:240] "Unable to update cni config" err="no networks found in /etc/cni/net.d"
#################################
Conditions:
  Type             Status  LastHeartbeatTime                 LastTransitionTime                Reason                       Message
  ----             ------  -----------------                 ------------------                ------                       -------
  MemoryPressure   False   Thu, 18 May 2023 10:35:34 +0800   Tue, 25 Apr 2023 18:49:53 +0800   KubeletHasSufficientMemory   kubelet has sufficient memory available
  DiskPressure     False   Thu, 18 May 2023 10:35:34 +0800   Tue, 25 Apr 2023 18:49:53 +0800   KubeletHasNoDiskPressure     kubelet has no disk pressure
  PIDPressure      False   Thu, 18 May 2023 10:35:34 +0800   Tue, 25 Apr 2023 18:49:53 +0800   KubeletHasSufficientPID      kubelet has sufficient PID available
  Ready            False   Thu, 18 May 2023 10:35:34 +0800   Tue, 25 Apr 2023 18:49:53 +0800   KubeletNotReady              container runtime network not ready: NetworkReady=false reason:NetworkPluginNotReady message:docker: network plugin is not ready: cni config uninitialized
Addresses:
  InternalIP:  192.168.145.128

2.解决方法

重新安装部署 CNI 网络插件 flannel

# 安装插件
[root@master hqm]# kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml
namespace/kube-flannel created
clusterrole.rbac.authorization.k8s.io/flannel created
clusterrolebinding.rbac.authorization.k8s.io/flannel created
serviceaccount/flannel created
configmap/kube-flannel-cfg created
daemonset.apps/kube-flannel-ds created

# 重启 docker 和 kubelet
[root@master hqm]# systemctl restart docker && systemctl restart kubelet

# 等待一会,成功运行 coredns,节点变为 ready 状态。
[root@master hqm]# kubectl get pod -n kube-system
NAME                             READY   STATUS    RESTARTS      AGE
coredns-6d8c4cb4d-ddmqf          1/1     Running   0             3h8m
coredns-6d8c4cb4d-j6swz          1/1     Running   0             3h8m
etcd-master                      1/1     Running   7 (40s ago)   22d
kube-apiserver-master            1/1     Running   6 (30s ago)   22d
kube-controller-manager-master   1/1     Running   6 (40s ago)   22d
kube-proxy-q8m5t                 1/1     Running   7 (29s ago)   22d
kube-scheduler-master            1/1     Running   7 (29s ago)   22d
[root@master hqm]# kubectl get nodes
NAME     STATUS   ROLES                       AGE   VERSION
master   Ready    control-plane,master,node   22d   v1.23.7
Logo

K8S/Kubernetes社区为您提供最前沿的新闻资讯和知识内容

更多推荐