CKS Challenger 4

After updating the kube-apiserver.yaml file as per the task. I am getting following error “The connection to the server controlplane:6443 was refused - did you specify the right host or port?”.
Steps taken to resolve the above issues-

  1. Restart kubelet server.
  2. Restart kube-apiserver container using docker command

Hi @gags23deep ,
Did you issue fixed ??

Nope, this issue is still there. Whenever I am trying to edit the kube-apiserver.yaml it is giving the above problem.

Hi @gags23deep

So the kubelet can’t talk to the apiserver after you made a change to apiserver, right?

If you get a connection error like that, it means you have made a mistake somewhere and the API server is not starting.

You should know how to troubleshoot a crashed API server. It is not impossible the exam could give you a broken cluster to fix, or even if you break it yourself like here.

Please read https://github.com/kodekloudhub/community-faq/blob/main/docs/diagnose-crashed-apiserver.md

I have a similiar issue, I had taken a backup of the kube-apiserver.yaml in /root/kube-apiserver.yaml.bk so when I changed the file in the /etc/kubernetes/manifest/kube-apiserver.yaml it wasnt starting the cluster at all. So I cp the .bk file to /etc/kubernetes/manifest/kube-apiserver.yaml as it was. But the cluster still wouldnt start.

There might be a lag before kubelet notices that the file in /etc/kubernetes/manifests has changed. The diagnose-crashed-apiserver page has good tips about figuring out what’s going on beyond that. It might be in the journalctl -u kubelet logs, or it might be in the logs of the kube-apiserver container. The github page will help you figure out how to access these.

Hi, I was able to debug and get ahead and complete the challenge 3 and 4. All I had to do was to restart the kubelet and verify the logs of kubelet. I thought the kube-apiserver.yaml created static pods and it would automatically bring the pod but it didnt. So restarting the kubelet service helped to bring the cluster and kube-apiserver pods back online.

If a pod has been down for a while, the kubelet backs off and refuses to restart it as quickly as you might want. The cure for this is to restart the kubelet.