Reputation: 4190
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.
Upvotes: 9
Views: 62916
Reputation: 11
To Fix this error you need to delete the config.toml file:
rm -rf /etc/containerd/config.toml
systemctl restart containerd
kubeadm init
Upvotes: 1
Reputation: 13
To the extend of the helped answer and in 2024, flag --pod-manifest-path=/etc/kubernetes/manifests
is deprecated. To solve issue only flag --fail-swap-on=false
is required. If after execution you still encounter same problem with service, you may try troubleshoot it with journalctl
.
Upvotes: 0
Reputation: 1372
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.
Upvotes: 9
Reputation: 7031
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.
Upvotes: 8