<p>I am trying to create a template for a Kubernetes cluster having 1 master and 2 worker nodes. I have installed all the pre-req software and have run the kubeadmn init on my master node. But when i try to run the kubeadmn join which i get as an output of the init command i am getting an error.</p>
<blockquote>
<pre class="lang-sh prettyprint-override"><code>[discovery] Created cluster-info discovery client, requesting info
from &quot;https://10.31.2.33:6443&quot; [discovery] Requesting info from
&quot;https://10.31.2.33:6443&quot; again to validate TLS against the pinned
public key [discovery] Cluster info signature and contents are valid
and TLS certificate validates against pinned roots, will use API
Server &quot;10.31.2.33:6443&quot; [discovery] Successfully established
connection with API Server &quot;10.31.2.33:6443&quot; [kubelet] Downloading
configuration for the kubelet from the &quot;kubelet-config-1.12&quot; ConfigMap
in the kube-system namespace [kubelet] Writing kubelet configuration
to file &quot;/var/lib/kubelet/config.yaml&quot; [kubelet] Writing kubelet
environment file with flags to file
&quot;/var/lib/kubelet/kubeadm-flags.env&quot; [preflight] Activating the
kubelet service [tlsbootstrap] Waiting for the kubelet to perform the
TLS Bootstrap... [patchnode] Uploading the CRI Socket information
&quot;/var/run/dockershim.sock&quot; to the Node API object &quot;&lt;workernode2&gt;&quot; as
an annotation error uploading crisocket: timed out waiting for the
condition```
</code></pre>
</blockquote>
<p>I have done a swapoff -a before running this on the workdernode2</p>
<p>I was able to run the join once but after that, as a part of a script, I ran the kubeadmn reset followed by init and join few times where this has started showing up.</p>
<p>Not able to figure out what or where I am doing a mistake.</p>
<p>My main intent is to put all the commands in the form of a shell script (on master node) so that it can be run on a cluster to create a network.</p>

<p>I had the encountered the following issue after node was rebooted:</p>
<pre class="lang-sh prettyprint-override"><code>[kubelet] Creating a ConfigMap &quot;kubelet-config-1.13&quot; in namespace kube-system with the configuration for the kubelets in the cluster
[patchnode] Uploading the CRI Socket information &quot;/var/run/dockershim.sock&quot; to the Node API object &quot;k8smaster&quot; as an annotation
[kubelet-check] Initial timeout of 40s passed.
error execution phase upload-config/kubelet: Error writing Crisocket information for the control-plane node: timed out waiting for the condition
</code></pre>
<p>Steps to get rid of this issue:</p>
<ol>
<li><p>Check the hostname again, after reboot it might have changed.</p>
<pre class="lang-sh prettyprint-override"><code>sudo vi /etc/hostname 
sudo vi /etc/hosts
</code></pre>
</li>
<li><p>Perform the following clean-up actions</p>
<p>Code:</p>
<pre class="lang-sh prettyprint-override"><code>sudo kubeadm reset
rm -rf /var/lib/cni/
sudo rm -rf /var/lib/cni/

systemctl daemon-reload

systemctl restart kubelet

sudo iptables -F &amp;&amp; sudo iptables -t nat -F &amp;&amp; sudo iptables -t mangle -F &amp;&amp; sudo iptables -X
</code></pre>
</li>
<li><p>Execute the init action with the special tag as below</p>
<p>Code:</p>
<pre class="lang-sh prettyprint-override"><code>sudo kubeadm init --pod-network-cidr=192.168.0.0/16 --apiserver-advertise-address=10.10.10.2 --ignore-preflight-errors=all    
</code></pre>
<p>(where 10.10.10.2 is the IP of master node and 192.168.0.0/16 is the private subnet assigned for Pods)</p>
</li>
</ol>
