【问题标题】:Kubernetes 1.17 containerd 1.2.0 with Calico CNI node not joining to masterKubernetes 1.17 containerd 1.2.0 与 Calico CNI 节点未加入主节点
【发布时间】:2020-05-01 18:46:48
【问题描述】:

我正在使用 containerd 和 Calico 作为 CNI 在 CentOS 8 上设置 kubernetes 集群。使用 kubeadm 命令设置主节点,其处于就绪状态。

当我将节点加入主节点时,节点未进入就绪状态。我看到下面的日志文件消息。

Jan 14 20:17:29 node02 containerd[1417]: time="2020-01-14T20:17:29.416373526-05:00" level=error msg="RunPodSandbox for &PodSandboxMetadata{Name:calico-node-fbst8,Uid:9c7f6334-d106-48e1-af12-1bcdebc7c2c2,Namespace:kube-system,Attempt:0,} failed, error" error="failed to start sandbox container: failed to create containerd task: OCI runtime create failed: container_linux.go:348: starting container process caused "process_linux.go:279: applying cgroup configuration for process caused \"Invalid unit name 'pod9c7f6334-d106-48e1-af12-1bcdebc7c2c2'\"": unknown"
Jan 14 20:17:29 node02 kubelet[30113]: E0114 20:17:29.416668   30113 remote_runtime.go:105] RunPodSandbox from runtime service failed: rpc error: code = Unknown desc = failed to start sandbox container: failed to create containerd task: OCI runtime create failed: container_linux.go:348: starting container process caused "process_linux.go:279: applying cgroup configuration for process caused \"Invalid unit name 'pod9c7f6334-d106-48e1-af12-1bcdebc7c2c2'\"": unknown
Jan 14 20:17:29 node02 kubelet[30113]: E0114 20:17:29.416742   30113 kuberuntime_sandbox.go:68] CreatePodSandbox for pod "calico-node-fbst8_kube-system(9c7f6334-d106-48e1-af12-1bcdebc7c2c2)" failed: rpc error: code = Unknown desc = failed to start sandbox container: failed to create containerd task: OCI runtime create failed: container_linux.go:348: starting container process caused "process_linux.go:279: applying cgroup configuration for process caused \"Invalid unit name 'pod9c7f6334-d106-48e1-af12-1bcdebc7c2c2'\"": unknown
Jan 14 20:17:29 node02 kubelet[30113]: E0114 20:17:29.416761   30113 kuberuntime_manager.go:729] createPodSandbox for pod "calico-node-fbst8_kube-system(9c7f6334-d106-48e1-af12-1bcdebc7c2c2)" failed: rpc error: code = Unknown desc = failed to start sandbox container: failed to create containerd task: OCI runtime create failed: container_linux.go:348: starting container process caused "process_linux.go:279: applying cgroup configuration for process caused \"Invalid unit name 'pod9c7f6334-d106-48e1-af12-1bcdebc7c2c2'\"": unknown
Jan 14 20:17:29 node02 kubelet[30113]: E0114 20:17:29.416819   30113 pod_workers.go:191] Error syncing pod 9c7f6334-d106-48e1-af12-1bcdebc7c2c2 ("calico-node-fbst8_kube-system(9c7f6334-d106-48e1-af12-1bcdebc7c2c2)"), skipping: failed to "CreatePodSandbox" for "calico-node-fbst8_kube-system(9c7f6334-d106-48e1-af12-1bcdebc7c2c2)" with CreatePodSandboxError: "CreatePodSandbox for pod \"calico-node-fbst8_kube-system(9c7f6334-d106-48e1-af12-1bcdebc7c2c2)\" failed: rpc error: code = Unknown desc = failed to start sandbox container: failed to create containerd task: OCI runtime create failed: container_linux.go:348: starting container process caused \"process_linux.go:279: applying cgroup configuration for process caused \\\"Invalid unit name 'pod9c7f6334-d106-48e1-af12-1bcdebc7c2c2'\\\"\": unknown"
Jan 14 20:17:30 node02 containerd[1417]: time="2020-01-14T20:17:30.541254039-05:00" level=error msg="Failed to load cni configuration" error="cni config load failed: no network config found in /etc/cni/net.d: cni plugin not initialized: failed to load cni config"
Jan 14 20:17:30 node02 kubelet[30113]: E0114 20:17:30.541394   30113 kubelet.go:2183] Container runtime network not ready: NetworkReady=false reason:NetworkPluginNotReady message:Network plugin returns error: cni plugin not initialized
Jan 14 20:17:35 node02 containerd[1417]: time="2020-01-14T20:17:35.541792325-05:00" level=error msg="Failed to load cni configuration" error="cni config load failed: no network config found in /etc/cni/net.d: cni plugin not initialized: failed to load cni config"
Jan 14 20:17:35 node02 kubelet[30113]: E0114 20:17:35.541929   30113 kubelet.go:2183] Container runtime network not ready: NetworkReady=false reason:NetworkPluginNotReady message:Network plugin returns error: cni plugin not initialized

有解决此错误的提示吗?

【问题讨论】:

    标签: kubernetes calico containerd


    【解决方案1】:

    您是否将--pod-network-cidr=192.168.0.0/16 设置为kubeadm init
    显然,你需要设置它。
    https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/create-cluster-kubeadm/#pod-network

    【讨论】:

    • 是的,我的 kubeadm 配置文件中有这个。我已经用 docker 设置了几个集群。这是第一次使用containerd
    • 我通过these commands尝试并成功。
    • 在设置后,我错过了为 kubelet 设置 cgroup args。我能够加入节点。感谢您的帮助。
    【解决方案2】:

    因为您没有使用 docker,所以您需要明确地 setup cgroup 驱动程序。

    要使用systemd cgroup driver,请在/etc/containerd/config.tomlsystemctl restart containerd 中设置plugins.cri.systemd_cgroup = true

    你必须修改/var/lib/kubelet中的文件kubeadm-flags.env并设置cgroups驱动。

    KUBELET_EXTRA_ARGS=--cgroup-driver=systemd
    

    确保指向/etc/systemd/system/kubelet.service.d/10-kubeadm.conf中的上述文件

    EnvironmentFile=-/var/lib/kubelet/kubeadm-flags.env
    

    【讨论】:

    • 谢谢,我忘记将 cgroup 驱动设置为 systemd
    猜你喜欢
    • 2018-08-02
    • 2018-10-29
    • 2019-05-24
    • 1970-01-01
    • 2020-01-15
    • 2021-01-12
    • 2019-07-14
    • 1970-01-01
    • 2020-09-27
    相关资源
    最近更新 更多