calico 容器启动不起来

来源:1-1 课程介绍

慕仰4468487

2022-06-06

老师您好! 麻烦您帮我分析下 通过报错的问题我也没有解决。
离线安装-k8s-1.22.1 calico-3.19.3

[root@k8s-master ~]# kubectl get pods --all-namespaces  -o wide
NAMESPACE     NAME                                       READY   STATUS                  RESTARTS      AGE     IP            NODE         NOMINATED NODE   READINESS GATES
default       myngx1-5476695b96-2l84m                    0/1     Pending                 0             17h     <none>        <none>       <none>           <none>
kube-system   calico-kube-controllers-6b59cd85f8-s264z   0/1     ContainerCreating       0             3m55s   <none>        k8s-master   <none>           <none>
kube-system   calico-node-6htkk                          0/1     Init:ImagePullBackOff   0             3m55s   10.24.24.70   k8s-node01   <none>           <none>
kube-system   calico-node-h6w9f                          0/1     CrashLoopBackOff        5 (51s ago)   3m55s   10.24.24.71   k8s-master   <none>           <none>

[root@k8s-master ~]# kubectl describe pod calico-kube-controllers-6b59cd85f8-s264z -n kube-system
Name:                 calico-kube-controllers-6b59cd85f8-s264z
Namespace:            kube-system
Priority:             2000000000
Priority Class Name:  system-cluster-critical
Node:                 k8s-master/10.24.24.71
Start Time:           Mon, 06 Jun 2022 11:02:22 +0800
Labels:               k8s-app=calico-kube-controllers
                      pod-template-hash=6b59cd85f8
Annotations:          <none>
Status:               Pending
IP:                   
IPs:                  <none>
Controlled By:        ReplicaSet/calico-kube-controllers-6b59cd85f8
Containers:
  calico-kube-controllers:
    Container ID:   
    Image:          docker.io/calico/kube-controllers:v3.19.3
    Image ID:       
    Port:           <none>
    Host Port:      <none>
    State:          Waiting
      Reason:       ContainerCreating
    Ready:          False
    Restart Count:  0
    Liveness:       exec [/usr/bin/check-status -l] delay=10s timeout=1s period=10s #success=1 #failure=6
    Readiness:      exec [/usr/bin/check-status -r] delay=0s timeout=1s period=10s #success=1 #failure=3
    Environment:
      ENABLED_CONTROLLERS:  node
      DATASTORE_TYPE:       kubernetes
    Mounts:
      /var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-bqt5r (ro)
Conditions:
  Type              Status
  Initialized       True 
  Ready             False 
  ContainersReady   False 
  PodScheduled      True 
Volumes:
  kube-api-access-bqt5r:
    Type:                    Projected (a volume that contains injected data from multiple sources)
    TokenExpirationSeconds:  3607
    ConfigMapName:           kube-root-ca.crt
    ConfigMapOptional:       <nil>
    DownwardAPI:             true
QoS Class:                   BestEffort
Node-Selectors:              kubernetes.io/os=linux
Tolerations:                 CriticalAddonsOnly op=Exists
                             node-role.kubernetes.io/master:NoSchedule
                             node.kubernetes.io/not-ready:NoExecute op=Exists for 300s
                             node.kubernetes.io/unreachable:NoExecute op=Exists for 300s
Events:
  Type     Reason                  Age                   From               Message
  ----     ------                  ----                  ----               -------
  Warning  FailedScheduling        4m58s                 default-scheduler  0/2 nodes are available: 2 node(s) had taint {node.kubernetes.io/not-ready: }, that the pod didn't tolerate.
  Normal   Scheduled               4m50s                 default-scheduler  Successfully assigned kube-system/calico-kube-controllers-6b59cd85f8-s264z to k8s-master
  Warning  FailedCreatePodSandBox  4m48s                 kubelet            Failed to create pod sandbox: rpc error: code = Unknown desc = [failed to set up sandbox container "d22b3cfabda3f56960655df37f2c25248476f943178641622bda4bcea462e343" network for pod "calico-kube-controllers-6b59cd85f8-s264z": networkPlugin cni failed to set up pod "calico-kube-controllers-6b59cd85f8-s264z_kube-system" network: error getting ClusterInformation: connection is unauthorized: Unauthorized, failed to clean up sandbox container "d22b3cfabda3f56960655df37f2c25248476f943178641622bda4bcea462e343" network for pod "calico-kube-controllers-6b59cd85f8-s264z": networkPlugin cni failed to teardown pod "calico-kube-controllers-6b59cd85f8-s264z_kube-system" network: error getting ClusterInformation: connection is unauthorized: Unauthorized]
  Normal   SandboxChanged          11s (x23 over 4m48s)  kubelet            Pod sandbox changed, it will be killed and re-created.


[root@k8s-master ~]# journalctl -f  -u kubelet
-- Logs begin at 六 2022-06-04 11:41:48 CST. --
6月 06 11:19:48 k8s-master kubelet[10648]: E0606 11:19:48.453881   10648 kuberuntime_manager.go:989] "Failed to stop sandbox" podSandboxID={Type:docker ID:d22b3cfabda3f56960655df37f2c25248476f943178641622bda4bcea462e343}
6月 06 11:19:48 k8s-master kubelet[10648]: E0606 11:19:48.453933   10648 kuberuntime_manager.go:751] "killPodWithSyncResult failed" err="failed to \"KillPodSandbox\" for \"2ca91924-d990-4bad-8a08-b5c829a86001\" with KillPodSandboxError: \"rpc error: code = Unknown desc = networkPlugin cni failed to teardown pod \\\"calico-kube-controllers-6b59cd85f8-s264z_kube-system\\\" network: error getting ClusterInformation: connection is unauthorized: Unauthorized\""
6月 06 11:19:48 k8s-master kubelet[10648]: E0606 11:19:48.453973   10648 pod_workers.go:747] "Error syncing pod, skipping" err="failed to \"KillPodSandbox\" for \"2ca91924-d990-4bad-8a08-b5c829a86001\" with KillPodSandboxError: \"rpc error: code = Unknown desc = networkPlugin cni failed to teardown pod \\\"calico-kube-controllers-6b59cd85f8-s264z_kube-system\\\" network: error getting ClusterInformation: connection is unauthorized: Unauthorized\"" pod="kube-system/calico-kube-controllers-6b59cd85f8-s264z" podUID=2ca91924-d990-4bad-8a08-b5c829a86001
6月 06 11:19:52 k8s-master kubelet[10648]: E0606 11:19:52.381046   10648 pod_workers.go:747] "Error syncing pod, skipping" err="failed to \"StartContainer\" for \"calico-node\" with CrashLoopBackOff: \"back-off 5m0s restarting failed container=calico-node pod=calico-node-h6w9f_kube-system(68698bda-003b-4bce-a5c3-6851a0111d73)\"" pod="kube-system/calico-node-h6w9f" podUID=68698bda-003b-4bce-a5c3-6851a0111d73
6月 06 11:20:01 k8s-master kubelet[10648]: E0606 11:20:01.461179   10648 cni.go:380] "Error deleting pod from network" err="error getting ClusterInformation: connection is unauthorized: Unauthorized" pod="kube-system/calico-kube-controllers-6b59cd85f8-s264z" podSandboxID={Type:docker ID:d22b3cfabda3f56960655df37f2c25248476f943178641622bda4bcea462e343} podNetnsPath="" networkType="calico" networkName="k8s-pod-network"
6月 06 11:20:01 k8s-master kubelet[10648]: E0606 11:20:01.461816   10648 remote_runtime.go:144] "StopPodSandbox from runtime service failed" err="rpc error: code = Unknown desc = networkPlugin cni failed to teardown pod \"calico-kube-controllers-6b59cd85f8-s264z_kube-system\" network: error getting ClusterInformation: connection is unauthorized: Unauthorized" podSandboxID="d22b3cfabda3f56960655df37f2c25248476f943178641622bda4bcea462e343"
6月 06 11:20:01 k8s-master kubelet[10648]: E0606 11:20:01.461850   10648 kuberuntime_manager.go:989] "Failed to stop sandbox" podSandboxID={Type:docker ID:d22b3cfabda3f56960655df37f2c25248476f943178641622bda4bcea462e343}
6月 06 11:20:01 k8s-master kubelet[10648]: E0606 11:20:01.461890   10648 kuberuntime_manager.go:751] "killPodWithSyncResult failed" err="failed to \"KillPodSandbox\" for \"2ca91924-d990-4bad-8a08-b5c829a86001\" with KillPodSandboxError: \"rpc error: code = Unknown desc = networkPlugin cni failed to teardown pod \\\"calico-kube-controllers-6b59cd85f8-s264z_kube-system\\\" network: error getting ClusterInformation: connection is unauthorized: Unauthorized\""
6月 06 11:20:01 k8s-master kubelet[10648]: E0606 11:20:01.461941   10648 pod_workers.go:747] "Error syncing pod, skipping" err="failed to \"KillPodSandbox\" for \"2ca91924-d990-4bad-8a08-b5c829a86001\" with KillPodSandboxError: \"rpc error: code = Unknown desc = networkPlugin cni failed to teardown pod \\\"calico-kube-controllers-6b59cd85f8-s264z_kube-system\\\" network: error getting ClusterInformation: connection is unauthorized: Unauthorized\"" pod="kube-system/calico-kube-controllers-6b59cd85f8-s264z" podUID=2ca91924-d990-4bad-8a08-b5c829a86001
6月 06 11:20:05 k8s-master kubelet[10648]: E0606 11:20:05.380626   10648 pod_workers.go:747] "Error syncing pod, skipping" err="failed to \"StartContainer\" for \"calico-node\" with CrashLoopBackOff: \"back-off 5m0s restarting failed container=calico-node pod=calico-node-h6w9f_kube-system(68698bda-003b-4bce-a5c3-6851a0111d73)\"" pod="kube-system/calico-node-h6w9f" podUID=68698bda-003b-4bce-a5c3-6851a0111d73

[root@k8s-master ~]# docker images
REPOSITORY                                                                      TAG       IMAGE ID       CREATED         SIZE
nginx                                                                           latest    0e901e68141f   8 days ago      142MB
calico/node                                                                     v3.19.3   5ee77fcf72b4   8 months ago    154MB
registry.cn-hangzhou.aliyuncs.com/google_containers/calico/node                 v3.19.3   5ee77fcf72b4   8 months ago    154MB
calico/pod2daemon-flexvol                                                       v3.19.3   c34539dc5eef   8 months ago    21.7MB
registry.cn-hangzhou.aliyuncs.com/google_containers/calico/pod2daemon-flexvol   v3.19.3   c34539dc5eef   8 months ago    21.7MB
calico/cni                                                                      v3.19.3   71da92beaffe   8 months ago    146MB
registry.cn-hangzhou.aliyuncs.com/google_containers/calico/cni                  v3.19.3   71da92beaffe   8 months ago    146MB
calico/kube-controllers                                                         v3.19.3   ed1e25e26ab5   8 months ago    60.6MB
registry.cn-hangzhou.aliyuncs.com/google_containers/calico/kube-controllers     v3.19.3   ed1e25e26ab5   8 months ago    60.6MB
registry.cn-hangzhou.aliyuncs.com/google_containers/pause                       3.5       ed210e3e4a5b   14 months ago   683kB


[root@k8s-master ~]# docker ps -a
CONTAINER ID   IMAGE                                                           COMMAND                  CREATED          STATUS                      PORTS     NAMES
ed29b7d58105   5ee77fcf72b4                                                    "start_runit"            4 minutes ago    Exited (1) 4 minutes ago              k8s_calico-node_calico-node-h6w9f_kube-system_68698bda-003b-4bce-a5c3-6851a0111d73_8
d22b3cfabda3   registry.cn-hangzhou.aliyuncs.com/google_containers/pause:3.5   "/pause"                 20 minutes ago   Exited (0) 20 minutes ago             k8s_POD_calico-kube-controllers-6b59cd85f8-s264z_kube-system_2ca91924-d990-4bad-8a08-b5c829a86001_0
2bed28089d8c   c34539dc5eef                                                    "/usr/local/bin/flex…"   20 minutes ago   Exited (0) 20 minutes ago             k8s_flexvol-driver_calico-node-h6w9f_kube-system_68698bda-003b-4bce-a5c3-6851a0111d73_0
a872a8155bbc   71da92beaffe                                                    "/opt/cni/bin/install"   20 minutes ago   Exited (0) 20 minutes ago             k8s_install-cni_calico-node-h6w9f_kube-system_68698bda-003b-4bce-a5c3-6851a0111d73_0
6042acecb28b   71da92beaffe                                                    "/opt/cni/bin/calico…"   20 minutes ago   Exited (0) 20 minutes ago             k8s_upgrade-ipam_calico-node-h6w9f_kube-system_68698bda-003b-4bce-a5c3-6851a0111d73_0
3afd329add5d   registry.cn-hangzhou.aliyuncs.com/google_containers/pause:3.5   "/pause"                 20 minutes ago   Up 20 minutes                         k8s_POD_calico-node-h6w9f_kube-system_68698bda-003b-4bce-a5c3-6851a0111d73_0



写回答

1回答

刘果国

2022-06-07

关注这里:0/2 nodes are available: 2 node(s) had taint {node.kubernetes.io/not-ready: }, that the pod didn't tolerate.

节点尚不是ready状态,先解决ready的问题


0
4
慕仰4468487
回复
刘果国
这一块我试了,no-ready情况下 去除污点不生效。kubectl apply -f calico.yaml 后虽然是 pod都处于失败状态,但是master的 no-ready 变成了ready ,污点也显示 none,只有node节点不行。老师请问能否加一下您的联系方式 ,这样回复没法贴图之类 只能文字描述可能我描述的不清楚
2022-06-08
共4条回复

Kubernetes生产落地全程实践

一个互联网公司落地Kubernetes全过程点点滴滴

2293 学习 · 2216 问题

查看课程