<p>I have a microk8s cluster on a ubuntu laptop.
I want to apply a deployment yaml file on it from azure devops pipeline.</p>
<p>I have successfully defined a  Kubernetes Service connections in my devops and it went through verification. Though when I try to apply the yaml file I get these lines</p>
<pre><code>/usr/bin/kubectl apply -f /home/vsts/work/1/s/devops/deploymen.yaml -o json


##[error]Unable to connect to the server: x509: certificate is valid for 127.0.0.1, 10.152.183.1, 192.168.50.69, 172.17.0.1, 10.1.80.0, not &lt;my external IP&gt;
</code></pre>
<p>192.168.50.69 is the ip of the laptop in my network</p>
<p>Where should I add my external IP?</p>
<p><strong>EDIT :</strong></p>
<p>I found <a href="https://microk8s.io/docs/ports#heading--auth" rel="noreferrer">Authentication and authorization</a> and I edited <code> /var/snap/microk8s/current/certs/csr.conf.template</code> so it includes my IP now.</p>
<p>The article says :</p>
<blockquote>
<p>After changing, the apiserver-kicker will automatically detect the difference, generate new certs and restart the apiserver. Your DNS server settings and <strong>kubeconfig</strong> file must be updated appropriately.</p>
</blockquote>
<p>The certificate in certificate-authority-data  <code>/var/snap/microk8s/current/certs/ca.crt</code> now looks different than the one from  <code> microk8s config</code></p>
<p>I also updated <strong>kubeconfig</strong> with as mentioned above</p>
<p>But still no luck !</p>

<p>The solution from these issues is to modify the template and add the missing IP address</p>
<p><code>/var/snap/microk8s/current/certs/csr.conf.template</code></p>
<pre class="lang-sh prettyprint-override"><code>...

[ alt_names ]
DNS.1 = kubernetes
DNS.2 = kubernetes.default
DNS.3 = kubernetes.default.svc
DNS.4 = kubernetes.default.svc.cluster
DNS.5 = kubernetes.default.svc.cluster.local
IP.1 = 127.0.0.1
IP.2 = 192.168.1.1
IP.100 = 192.168.1.1 # USE IP &gt; 100
#MOREIPS

...
</code></pre>
<blockquote>
<p>When you modify this template files, microk8s daemon generates a new <code>csr.conf</code></p>
</blockquote>
<p>This happens because if you check the <code>sudo cat /var/snap/microk8s/current/certs/csr.conf</code> file the ID of the IP you are assigning is taken by another IP.</p>
<p>To solve this collision, a higher ID must be used and this will work</p>
