I've installed Kubernetes 1.9.2 on the master node (Ubuntu 16.04) including the dashboard.
All the pods were running fine. After rebooting, when I try to run kubectl get nodes
I get the following:
The connection to the server 10.50.88.230:6443 was refused - did you specify the right host or port?
If I run kubectl cluster-info
I get:
Kubernetes master is running at https://10.50.88.230:6443
To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.
The connection to the server 10.50.88.230:6443 was refused - did you specify the right host or port?
If I run kubectl cluster-info dump
I get the same error. I have no idea how to fix it.
The issue may arise due to following reasons:
Kubernetes does not work with "Swap" in place.
Temporary solution:
sudo -i swapoff -a exit strace -eopenat kubectl version
Permanent solution:
Remove any reference to "swap" from file /etc/fstab
When the system is rebooted,IP changes and hence the previously initialised network is not being served on the same address anymore. You might see the following error when you run any kubectl command: Unable to connect to the server: dial tcp XXX.XXX.X.XXX:6443: i/o timeout
Temporary solution:
Reinitialise the network(assuming user is not working with minikube): sudo kubeadm reset sudo kubeadm init --pod-network-cidr=192.168.0.16/24
Permanent solution:
Make your system's IP static.
So it turns out that it's normal that Kubernetes stops working after a reboot. Need to write a script that runs at boot time and that automates the installation steps, like kubeadm reset
and all the following initialisation steps.