kubelet service is not starting

Viewed 19718

While running commands such as kubectl get nodes resulting with following error:

The connection to the server :6443 was refused - did you specify the right host or port?

I ran systemctl status kubelet.service and receiving the following state:

root@k8s-l2bridge-ma:~# sudo systemctl status kubelet.service

● kubelet.service - kubelet: The Kubernetes Node Agent
   Loaded: loaded (/lib/systemd/system/kubelet.service; enabled; vendor preset: enabled)
  Drop-In: /etc/systemd/system/kubelet.service.d
           └─10-kubeadm.conf
   Active: activating (auto-restart) (Result: exit-code) since Tue 2020-06-16 11:46:05 UTC; 9s ago
     Docs: https://kubernetes.io/docs/home/
  Process: 28012 ExecStart=/usr/bin/kubelet $KUBELET_KUBECONFIG_ARGS $KUBELET_CONFIG_ARGS $KUBELET_KUBEADM_ARGS $KUBELET_EXTRA_ARGS (code=exited, status=255)
 Main PID: 28012 (code=exited, status=255)

Jun 16 11:46:05 k8s-l2bridge-ma systemd[1]: kubelet.service: Failed with result 'exit-code'.

How can I troubleshoot the failure and find out what is wrong? I found few leads googling but nothing solved the problem.

2 Answers

Just make the modification on the file /etc/systemd/system/kubelet.service.d/10-kubeadm.conf

Environment="KUBELET_SYSTEM_PODS_ARGS=--pod-manifest-path=/etc/kubernetes/manifests --allow-privileged=true --fail-swap-on=false"

then execute commands:

 $ systemctl daemon-reload

 $ systemctl restart kubelet

Take a look: fail-kubelet-service, kubelet-failed-start.

in my case deleting swap memory worked out.

swapoff -a

To permanently disable Linux swap space, open the /etc/fstab file, search for a swap line and add a # (hashtag) sign in front of the line to comment on the entire line.

Related