<p>I'm trying to connect to kubernetes cluster deployed by kubeadm on AWS lightsail instances (Master &amp; 2 worker nodes). I copied the .kube/config file to my local machine and replaced the <code>server: https://172.26.2.101:6443</code> with <code>server: https://&lt;public_ip_address&gt;:6443</code> and tried to connect. but got below error</p>
<pre><code>Unable to connect to the server: x509: certificate is valid for 10.96.0.1, 172.26.2.101, not &lt;public_ip_address&gt;
</code></pre>
<p>Any ideas ?!</p>
<p>Thanks,</p>

Nurhun
<p>I've found the solution below,</p>
<p>remove current apiserver certificates</p>
<pre><code>sudo rm /etc/kubernetes/pki/apiserver.*
</code></pre>
<p>generate new certificates adding the public ip</p>
<pre><code>sudo kubeadm init phase certs apiserver --apiserver-cert-extra-sans=&lt;public_ip&gt;
</code></pre>
