Kubectl Unable to Connect Kubernetes remote access
Just set up a brand new cluster ?. Changed the domain or IP of your admin node ?
Then you may have encountered the error Unable to connect to the server: x509: certificate is valid for X.X.X.X.
The following is a fix for this common issue. However, there are often other reasons to rebuild your cluster cert, and it’s relatively easy.
- Step1 : remove certificate
$ rm /etc/kubernetes/pki/apiserver.*
- Step2 : Rebuild your cluster cert
$ kubeadm init phase certs all --apiserver-advertise-address=0.0.0.0 --apiserver-cert-extra-sans=your_ip_address
- Step3 : Restart kubelet service
$ systemctl restart kubelet
For your local development see kubefwd, a simple command line utility that mass transfers services from one or more namespaces to your local workstation.