<p>After every reboot my kubernetes cluster does not work fine and I get</p>
<pre><code>The connection to the server 192.168.1.4:6443 was refused - did you specify the right host or port?
</code></pre>
<p>I have 4 ubuntu on <strong>baremetal</strong> one of them is master and 3 worker and I <strong>turned off swap and disabled it</strong>.
and I read somewhere I should run this command two solve it</p>
<pre><code>sudo -i
swapoff -a
exit
strace -eopenat kubectl version
</code></pre>
<p>and it is work.
But why this was happening?</p>

yasin lachini
<p>First please run <code>systemctl status kubelet</code> and verify if the service is running: <br/>
"<em>Active: active (running)</em>"<br/>
Disable swap:<br/></p>

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

<p>verify all reference found in <strong>/etc/fstab</strong> about swap.</p>

<p>Please perform also post "kubeadm init" steps for current user as described here:
<a href="https://kubernetes.io/docs/setup/independent/create-cluster-kubeadm/" rel="noreferrer">https://kubernetes.io/docs/setup/independent/create-cluster-kubeadm/</a></p>

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

<p>After reboot please check:<br/>
<code>systemctl status docker</code>
enable docker at startup if it's not working<br/>
<code>systemctl enable docker</code><br/></p>

<p>You can also verify kubelet status:<br/>  </p>

<pre><code>systemctl status kubelet
systemctl enable kubelet
</code></pre>

<p>take a look for any errors:<br/></p>

<pre><code>journalctl -u kubelet.service
journalctl
</code></pre>

<p>And please share with your findings.</p>
