<p>This probably means you've got a dangling <code>~/.kube/config</code> left over from a prior installation where you <a href="https://devops.stackexchange.com/a/16044/18965">followed instructions like these to set up <code>~/.kube/config</code></a> and you've since reinstalled k3s and left the old kubeconfig. You simply need to generate a new copy of your <code>~/.kube/config</code> in your home directory.</p>
<p>You can do this like this,</p>
<pre><code># if not set, set it to the right location
# export KUBECONFIG=~/.kube/config

sudo k3s kubectl config view --raw &gt; &quot;$KUBECONFIG&quot;
</code></pre>

CC BY-SA 4.0
2023-01-17T23:05:39.670Z
2023-01-18T16:10:22.837Z
2023-01-18T16:10:22.837Z
Evan Carroll
<p>When I run something with k3s, like <code>kubectl apply</code>, I'm getting</p>
<blockquote>
<p>Unable to connect to the server: x509: certificate signed by unknown authority</p>
</blockquote>

<kubectl><k3s>
With kubectl, I'm getting Unable to connect to the server: x509: certificate signed by unknown authority
Evan Carroll
# With kubectl, I'm getting Unable to connect to the server: x509: certificate signed by unknown authority

(Asked by: username_0 on 2023-01-17)

When I run something with k3s, like `kubectl apply`, I'm getting

> Unable to connect to the server: x509: certificate signed by unknown authority

**Tags:** kubectl, k3s


---

## 1 answers

### Answer by username_0 on 2023-01-17. Score: 3 | Accepted answer

This probably means you've got a dangling ~/.kube/config left over from a prior installation where you followed instructions like these to set up ~/.kube/config and you've since reinstalled k3s and left the old kubeconfig. You simply need to generate a new copy of your ~/.kube/config in your home directory.
You can do this like this,
# if not set, set it to the right location
# export KUBECONFIG=~/.kube/config

sudo k3s kubectl config view --raw > "$KUBECONFIG"


---

