kubectl get node notReady | network not ready | kube-flannel not ready

问题

# 查看 node 状态 notReady

[root@localhost ~]# kubectl get node
NAME    STATUS     ROLES           AGE   VERSION
node1   NotReady   control-plane   31m   v1.27.4

# 查看详细信息 network not ready
[root@localhost ~]# kubectl describe node node1
Name:               node1
Conditions:
  Type             Status  LastHeartbeatTime                 LastTransitionTime                Reason                       Message
  ----             ------  -----------------                 ------------------                ------                       -------
  MemoryPressure   False   Wed, 02 Aug 2023 12:37:20 -0400   Wed, 02 Aug 2023 12:07:12 -0400   KubeletHasSufficientMemory   kubelet has sufficient memory available
  DiskPressure     False   Wed, 02 Aug 2023 12:37:20 -0400   Wed, 02 Aug 2023 12:07:12 -0400   KubeletHasNoDiskPressure     kubelet has no disk pressure
  PIDPressure      False   Wed, 02 Aug 2023 12:37:20 -0400   Wed, 02 Aug 2023 12:07:12 -0400   KubeletHasSufficientPID      kubelet has sufficient PID available
  Ready            False   Wed, 02 Aug 2023 12:37:20 -0400   Wed, 02 Aug 2023 12:07:12 -0400   KubeletNotReady              container runtime network not ready: NetworkReady=false reason:NetworkPluginNotReady message:Network plugin returns error: cni plugin not initialized 

增加 flannel

# 网络失败

[root@localhost ~]# kubectl apply -f https://github.com/flannel-io/flannel/releases/latest/download/kube-flannel.yml

# 下载 github kube-flannel.yml 内容到本地文件中

[root@localhost ~]# kubectl apply -f kube-flannel.yaml 
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

 查看 pod 状态,flannel 在 kube-flannel namespace 下,且notReady

[root@localhost ~]# kubectl get pod -A
NAMESPACE      NAME                            READY   STATUS                  RESTARTS   AGE
kube-flannel   kube-flannel-ds-sxb9l           0/1     Init:ImagePullBackOff   0          19m
kube-system    coredns-7bdc4cb885-7b6cl        0/1     Pending                 0          39m
kube-system    coredns-7bdc4cb885-v5gkm        0/1     Pending                 0          39m
kube-system    etcd-node1                      1/1     Running                 0          39m
kube-system    kube-apiserver-node1            1/1     Running                 0          39m
kube-system    kube-controller-manager-node1   1/1     Running                 0          39m
kube-system    kube-proxy-2s4l7                1/1     Running                 0          39m
kube-system    kube-scheduler-node1            1/1     Running                 0          39m

查看 kube-flannel.yaml,是因为github上namespace指定的是namespace: kube-flannel

[root@localhost ~]# cat kube-flannel.yaml | grep namespace
  namespace: kube-flannel
  namespace: kube-flannel
  namespace: kube-flannel
  namespace: kube-flannel 

根据网上的 资料

https://www.saoniuhuo.com/question/detail-2644145.html

修改 kube-flannel.yaml 文件中 四个namespace: kube-flannel 为 namespace: kube-system 

重新 apply yml 文件

[root@localhost ~]# kubectl delete -f kube-flannel.yaml 
clusterrole.rbac.authorization.k8s.io "flannel" deleted
clusterrolebinding.rbac.authorization.k8s.io "flannel" deleted
serviceaccount "flannel" deleted
configmap "kube-flannel-cfg" deleted
daemonset.apps "kube-flannel-ds" deleted

[root@localhost ~]# vi kube-flannel.yaml 


[root@localhost ~]# kubectl apply -f kube-flannel.yaml 
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


[root@localhost ~]# kubectl get pod -A
NAMESPACE     NAME                            READY   STATUS              RESTARTS   AGE
kube-system   coredns-7bdc4cb885-7b6cl        0/1     ContainerCreating   0          55m
kube-system   coredns-7bdc4cb885-v5gkm        0/1     ContainerCreating   0          55m
kube-system   etcd-node1                      1/1     Running             0          55m
kube-system   kube-apiserver-node1            1/1     Running             0          55m
kube-system   kube-controller-manager-node1   1/1     Running             0          55m
kube-system   kube-flannel-ds-m8rjp           1/1     Running             0          4s
kube-system   kube-proxy-2s4l7                1/1     Running             0          55m
kube-system   kube-scheduler-node1            1/1     Running             0          55m


[root@localhost ~]# kubectl get node
NAME    STATUS   ROLES           AGE   VERSION
node1   Ready    control-plane   56m   v1.27.4

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

beOkWithAnything

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值