I am using Vagrant to a build Kubernetes cluster with one master and two nodes. Every time I run kubectl get nodes
after switching my computer off and on again, I get the following error message:
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")
you just need to enter that command:
sudo cp /etc/kubernetes/admin.conf $HOME/
sudo chown $(id -u):$(id -g) $HOME/admin.conf
export KUBECONFIG=$HOME/admin.conf
its working for me.
I'm not sure how you did setup the kubernetes cluster. If you want to use vagrant you can use the setup here. This sets up one masternode and two slaves nodes.
Once the vagrant up
command is complete, do vagrant ssh k8s-head
and do kubectl get nodes
.
You will get the list of slaves nodes.
Hope this helps.