Get public key for new cert from k3s

Viewed 17

So I got locked out of my Kubernetes instance, presumably due to a cert expiration. It was created with k3sup, by someone with a lot more Kubernetes experience than me.

To dig into the issue, I used AWS session manager to connect to the instance. When I ran sudo kubectl get pods -A from within the instance, I got the same error as I got from my local machine:

error: You must be logged in to the server (Unauthorized)

I then ran sudo systemctl restart k3s to restart the kubernetes, and which supposedly rotates the certs. Now kubectl commands work from within the container, which is great, but still not from my local machine.

If this did rotate the cert as I assume, I think I need the new public key for my local ~/.kube/config. Where do I get this?

1 Answers

I found the updated certs in the kube config at /etc/rancher/k3s/k3s.yaml

Related