Forum Navigation
You need to log in to create posts and topics.

Kuberenetes Cluster IP address changed and cant connect with kubectl

Problem

Kuberenetes Cluster IP Address changed and kubectl management utility can’t connet

 

Solution

Run the following commands in order to fix the utility

systemctl stop kubelet docker
cd /etc/
mv kubernetes kubernetes-backup
mv /var/lib/kubelet /var/lib/kubelet-backup
mkdir -p kubernetes
cp -r kubernetes-backup/pki kubernetes
rm kubernetes/pki/{apiserver.*,etcd/peer.*}
systemctl start docker
kubeadm init –ignore-preflight-errors=DirAvailable–var-lib-etcd
cp kubernetes/admin.conf ~/.kube/config
kubectl get nodes –sort-by=.metadata.creationTimestamp
kubectl delete node $(kubectl get nodes -o jsonpath='{.items[(@.status.conditions[0].status==”Unknown”)].metadata.name}’)
kubectl get pods –all-namespaces

 

Notes:

if you see one of the following errors:
“error execution phase preflight: [preflight] Some fatal errors occurred:
[ERROR FileAvailable–etc-kubernetes-kubelet.conf]: /etc/kubernetes/kubelet.conf already exists
[ERROR Port-10250]: Port 10250 is in use
[ERROR FileAvailable–etc-kubernetes-pki-ca.crt]: /etc/kubernetes/pki/ca.crt already exists”

Run “kubeadm reset” on all nodes

If you have found my website, guides, articles or videos useful, please buy me a coffee