<p>I was trying to configure a new installation of Lens IDE to work with my remote cluster (on a remote server, on a VM), but encountered some errors and can't find a proper explanation for this case.</p>
<p>Lens expects a config file, I gave it to it from my cluster having it changed from</p>
<p><code>server: https://127.0.0.1:6443</code></p>
<p>to</p>
<p><code>server: https://</code><strong>(address to the remote server)</strong><code>:</code><strong>(assigned intermediate port to 6443 of the VM with the cluster)</strong></p>
<p>After which in Lens I'm getting this:</p>
<pre><code>2021/06/14 22:55:13 http: proxy error: x509: certificate is valid for 10.43.0.1, 127.0.0.1, 192.168.1.122, not (address to the remote server)
</code></pre>
<p>I can see that some cert has to be reconfigured, but I'm absolutely new to the thing.</p>
<p>Here the full contents of the original config file:</p>
<pre><code>apiVersion: v1
clusters:
- cluster:
    certificate-authority-data: LS0...
    server: https://127.0.0.1:6443
  name: default
contexts:
- context:
    cluster: default
    user: default
  name: default
current-context: default
kind: Config
preferences: {}
users:
- name: default
  user:
    client-certificate-data: LS0...
    client-key-data: LS0...
</code></pre>

Mike
<p>The solution is quite obvious and easy.</p>
<p>k3s has to add the new IP to the certificate. Since by default, it includes only localhost and the IP of the node it's running on, if you (like me) have some kind of machine in from of it(like an lb or a dedicated firewall), the IP of one has to be added manually.</p>
<p>There are two ways how it can be done:</p>
<ol>
<li>During the installation of k3s:</li>
</ol>
<blockquote>
<pre><code>curl -sfL https://get.k3s.io | sh -s - server --tls-san desired IP
</code></pre>
</blockquote>
<ol start="2">
<li>Or this argument can be added to already installed k3s:</li>
</ol>
<blockquote>
<pre><code>sudo nano /etc/systemd/system/k3s.service
</code></pre>
</blockquote>
<blockquote>
<pre><code>ExecStart=/usr/local/bin/k3s \
    server \
        '--tls-san' \
        'desired IP' \
</code></pre>
</blockquote>
<blockquote>
<pre><code>sudo systemctl daemon-reload
</code></pre>
</blockquote>
<p>P.S. Although, I have faced issues with the second method.</p>
