kubernetes 1.12.2 failed to load Kubelet config file /var/lib/kubelet/config.yaml

Viewed 11245

Environment:

  • Kubernetes 1.12.2
  • Docker 18.9.0
  • microk8s.kubectl

$ k get all

NAME                                          READY   STATUS             
RESTARTS   AGE
pod/mysql-0                                   1/1     Running            0          72s
pod/nginx-ingress-microk8s-controller-c2pgz   0/1     CrashLoopBackOff   129        22h
pod/web-0                                     1/1     Running            0          78s

NAME                    TYPE        CLUSTER-IP     EXTERNAL-IP   PORT(S)    AGE
service/kubernetes      ClusterIP   10.152.183.1   <none>        443/TCP    70m
service/mysql-service   ClusterIP   None           <none>        3306/TCP   72s
service/nginx-service   ClusterIP   None           <none>        80/TCP     78s

NAME                                               DESIRED   CURRENT   READY   UP-TO-DATE   AVAILABLE   NODE SELECTOR   AGE
daemonset.apps/nginx-ingress-microk8s-controller   1         1         0       1            0           <none>          2d22h

NAME                     DESIRED   CURRENT   AGE
statefulset.apps/mysql   1         1         72s
statefulset.apps/web     1         1         78s

/var/log/syslog:

failed to load Kubelet config file /var/lib/kubelet/config.yaml, error failed to read kubelet config file "/var/lib/kubelet/config.yaml", error: open /var/lib/kubelet/config.yaml: no such file or directory

Error syncing pod f0ab0f74-e6f2-11e8-8410-482ae31e6a94 ("nginx-ingress-microk8s-controller-c2pgz_default(f0ab0f74-e6f2-11e8-8410-482ae31e6a94)"), skipping: failed to "StartContainer" for "nginx-ingress-microk8s" with CrashLoopBackOff: "Back-off 5m0s restarting failed container=nginx-ingress-microk8s pod=nginx-ingress-microk8s-controller-c2pgz_default(f0ab0f74-e6f2-11e8-8410-482ae31e6a94)"

What is nginx-ingress-microk8s-controller-c2pgz? Who started it?

3 Answers

You mentioned in the comments that the reason is related to kubeadm init fails.

The /var/lib/kubelet/config.yaml config file is being populated only after:

  1. A successful cluster initialization (kubeadmin init) in the master node.

  2. In the worker node - after a successful joining to the cluster (kubeadm join).

So if the problem is with kubeadm init you should check the command's output (also great if you could paste it in the question).
Make sure you don't run kubeadm init with the --ignore-preflight-errors=all flag.

I'm not familiar with your specific error, but in order for the answer to be more helpful - I'll try to give some possible solutions:

  1. Make sure all requirements for kubeadm are in place.

  2. Check the firewall rules - make sure you don't block egress traffic and that port 6443 ingress rule is open for the worker node (relevant for the joining phase).

  3. Make sure that the required ports are not occupied.

  4. Try restarting Kubelet with systemctl restart kubelet and check latest logs with:
    sudo journalctl -u kubelet -n 100 --no-pager.

  5. Check if Docker version can be updated to a newer stabler one.

  6. Try running kubeadm reset and make sure you re-run kubeadm init with latest version or with the specific stable version by addding --kubernetes-version=X.Y.Z.

As per RtmY, it works only kubectl initilzation works correct after doing following

kubeadm  init --pod-network-cidr=192.168.0.0/16

it worked successfully.

Related