How to update authentication info of ~/kube/config after re-install of microk8s?

In the post Microk8s cluster stuck after installing OLM 0.14.1. My microk8s cluster got stuck I don’t know how to untangle. The simple solution was to remove and re-install microk8s from scratch.

After the install, I cannot authenticate with my new cluster:

# NOTE: this is the regular kubectl (not microk8s.kubectl)
$ kubectl get namespaces

Unable to connect to the server: x509: certificate signed by unknown authority (possibly because of "crypto/rsa: verification error" while trying to verify candidate authority certificate "10.152.183.1")

Can you please show how to update ~/kube/config with the certificate-authority-data of the new cluster and the password of the admin user?

Answer in Where does microk8s store kubectl config file? . Thank you @kjackal

Just need to copy the info from /var/snap/microk8s/current/credentials/client.config to ${HOME}/.kube/config

1 Like