my kubernetes cluster is down after reboot

4/7/2019

After every reboot my kubernetes cluster does not work fine and i get

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

I have 4 ubuntu on baremetal one of them is master and 3 worker and i turn off swap and disable it. and i read somewhere i should run this command two solve it

sudo -i
swapoff -a
exit
strace -eopenat kubectl version

and it is work. But why this was happening?

-- yasin lachini
bare-metal-server
kubernetes

2 Answers

4/7/2019

Most likely that Kubelet is not getting restarted. You need to check Kubelet logs correct the issues if any.

Check docker driver and the driver used by kubelet should be same.

Swap should be disabled, and so on

-- P Ekambaram
Source: StackOverflow

4/8/2019

First please run systemctl status kubelet and verify if the service is running:
"Active: active (running)"
Disable swap:

sudo swapoff -a
sudo sed -i '/ swap / s/^\(.*\)$/#\1/g' /etc/fstab

verify all reference found in /etc/fstab about swap.

Please perform also post "kubeadm init" steps for current user as described here: https://kubernetes.io/docs/setup/independent/create-cluster-kubeadm/

mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config

After reboot please check:
systemctl status docker enable docker at startup if it's not working
systemctl enable docker

You can also verify kubelet status:

systemctl status kubelet
systemctl enable kubelet

take a look for any errors:

journalctl -u kubelet.service
journalctl

And please share with your findings.

-- Hanx
Source: StackOverflow