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 “kubernetes”)

This is a permission error with the “admin” user.

[email protected]:~$ kubectl get pods -n kube-system
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 “kubernetes”)

One of the WORKAROUND is to overwrite the existing kubeconfig for the “admin” user, directory is /home/vagrant/.kube

mv  $HOME/.kube $HOME/.kube.bak
mkdir $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config

Series Navigation<< The guest additions on this VM do not match the install version of VirtualBox.Unable to connect to the server: x509: certificate is valid for x.x.x.x” error >>