Summary of installation problems of kubernetes(kubeadm) cluster

1. kubelet and docker driver are inconsistent (other attempts to solve copywriting on the Internet are invalid, and finally the following methods are used to solve)
Exception [kubelet cgroup driver: cgroupfs is inconsistent with docker cgroup driver: systemd]

The exception is described as follows:
failed to create kubelet: misconfiguration: kubelet cgroup driver: "cgroupfs" is different from docker cgroup driver: "systemd"
  • Cause analysis
    The default cgroupfs is driven by the kubelet file, while the file driver used by the installed docker is systemd, which causes inconsistency and the image cannot be started.
  • resolvent:
    1) Confirm docker profile daemon.json Drive configuration for
    [root@master~]# cat  /etc/docker/daemon.json
    "registry-mirrors": [""],
    "exec-opts": ["native.cgroupdriver=systemd"]

    2) Modify / var/lib/kubelet/kubeadm-flags.env Driver configuration, add -- CGroup driver = SYSTEMd parameter

    [root@master~]# cat /var/lib/kubelet/kubeadm-flags.env
    KUBELET_KUBEADM_ARGS="--cgroup-driver=systemd --network-plugin=cni"
    #Restart docker and kubelet
    [root@master~]# systemctl daemon-reload && systemctl restart docker kubelet

    2,/ system.slice/kubelet.service is not recognized

  • Failed to get system container stats for kubelet.service ]
    The exception is described as follows
    failed to get container info for "/system.slice/kubelet.service": unknown container "/system.slice/kubelet.service"
  • Solution
    modify kubelet.service
    [root@master~]# vim /lib/systemd/system/kubelet.service
    #At the end of the ExecStart location, add the following configuration
    --runtime-cgroups=/systemd/system.slice \

3, kubeadm initialization time [ERROR NumCPU]

  • The exception is described as follows
    kubeadm init --apiserver-advertise-address= --image-repository
    ers --kubernetes-version v1.17.0 --service-cidr= --pod-network-cidr= 22:45:14.131024    8293 validation.go:28] Cannot validate kube-proxy config - no validator is available
    W0521 22:45:14.131095    8293 validation.go:28] Cannot validate kubelet config - no validator is available
    [init] Using Kubernetes version: v1.17.0
    [preflight] Running pre-flight checks
    error execution phase preflight: [preflight] Some fatal errors occurred:
    [ERROR NumCPU]: the number of available CPUs 1 is less than the required 2
    [preflight] If you know what you are doing, you can make a check non-fatal with `--ignore-preflight-errors=...`
    To see the stack trace of this error execute with --v=5 or higher
  • Solution 1:
    This error generally occurs on VMware virtual machines, because when a VM is created, it is one core by default. It can be adjusted to two cores through configuration, and the system can be restarted, as shown below:
  • Solution 2:
    Add ignore-preflight-errors =
    $ kubeadm init \
    --apiserver-advertise-address= \
    --image-repository \
    --kubernetes-version v1.17.0 \
    --service-cidr= \
    --pod-network-cidr= --ignore-preflight-errors=NumCPU

Tags: kubelet Docker network Kubernetes

Posted on Fri, 22 May 2020 12:14:36 -0400 by philvia