<p>I'm playing around with Kubernetes on Virtualbox. I have created 2 VMs, one is the Master - the other one is the Worker. The Worker is a clone of the basis installation of the master. I guess that's the root-cause of the problem, maybe there's some config left over which causes conflicts.</p>
<p>When I try to join the Worker with ...</p>
<pre><code>sudo kubeadm join 192.168.56.101:6443 --token ... --discovery-token-ca-cert-hash ...
</code></pre>
<p>I get the following error ...</p>
<blockquote>
<p>error execution phase kubelet-start: a Node with name &quot;test-virtualbox&quot;
and status &quot;Ready&quot; already exists in the cluster. You must delete the
existing Node or change the name of this new joining Node</p>
</blockquote>
<p>I have tried to reset the config with ...</p>
<pre><code>sudo kubeadm reset
</code></pre>
<p>But after running the join command I get the same error again.</p>
<p>I also tried to delete the node &quot;test-virtualbox&quot; by running ...</p>
<pre><code>sudo kubectl delete node test-virtualbox
</code></pre>
<p>But this results in the error ...</p>
<blockquote>
<p>The connection to the server localhost:8080 was refused</p>
</blockquote>

<p>There are several problems or questions you mentioned</p>
<blockquote>
<p>a Node with name &quot;test-virtualbox&quot; and status &quot;Ready&quot; already exists in the cluster.</p>
</blockquote>
<p><code>kubeadm</code> uses the hostname as the node name by default, as you Clone the worker from the master, they should have the same hostname as the error said.</p>
<p>the solution for this could be:</p>
<ol>
<li>Give Worker a new hostname by <code>hostnamectl</code> or some other tools.</li>
<li>Use the <a href="https://kubernetes.io/docs/reference/setup-tools/kubeadm/kubeadm-join/" rel="nofollow noreferrer">--node-name</a> flag when joining the worker</li>
</ol>
<hr />
<blockquote>
<p>sudo kubeadm reset</p>
</blockquote>
<p><code>reset</code> is used to reset a node inside the cluster, your worker has not yet joined, it does nothing when you did this.</p>
<hr />
<blockquote>
<p>sudo kubectl delete node test-virtualbox</p>
</blockquote>
<p>This is executed on the Worker, right?</p>
<p>The Worker has not yet joined the cluster, so you do not have a <code>kubeconfig</code> in <code>~/.kube/config</code>, kubectl will use <code>localhost:8080</code> as server address by default, it can not connect to the target API Server, so that error occurred.</p>
<hr />
