CKAD - challenge 2, kubernetes challenge 2

Hi Community,
I was trying the CKADD - CHALLENGE 2, KUBERNETES CHALLENGE 2 to resolve the issue with the node. I’m able to identify that the ca.crt in Kube-apiserver config is not correct and updated it. also update the port in $home/.kube/config. Still im getting the below error. Can someone advise what am I missing?

The connection to the server controlplane:6443 was refused - did you specify the right host or port?

Thanks,
Devan

Hi @Arul-Devan ,
Can you please try once with our solutions?
kubernetes-challenges/challenge-2 at master · kodekloudhub/kubernetes-challenges · GitHub

Regards,

This helps. Thanks for sharing.

Hey folks. Sorry, but this has not worked for me.
I changed the --client-ca-file parameter as you can see here

root@controlplane /etc/kubernetes/manifests ✖ diff kube-apiserver.yaml kube-apiserver.yaml-bckup 
19c19
<     - --client-ca-file=/etc/kubernetes/pki/ca.crt
---
>     - --client-ca-file=/etc/kubernetes/pki/ca-authority.crt

I have tried both, waiting for it to restart and doing the systemctl restart kubelet
the kube-apiserver does not come up.

When I check systemctl status kubelet this is what I see

 Main PID: 24759 (kubelet)
    Tasks: 47 (limit: 251382)
   CGroup: /system.slice/kubelet.service
           └─24759 /usr/bin/kubelet --bootstrap-kubeconfig=/etc/kubernetes/bootstrap-kubelet.conf --kubeconfig=/etc/kubernetes/kubelet.conf --config=/var/lib/kubelet/config.y

Sep 17 18:14:33 controlplane kubelet[24759]: E0917 18:14:33.494390   24759 kubelet.go:2422] "Error getting node" err="node \"controlplane\" not found"
Sep 17 18:14:33 controlplane kubelet[24759]: E0917 18:14:33.595107   24759 kubelet.go:2422] "Error getting node" err="node \"controlplane\" not found"
Sep 17 18:14:33 controlplane kubelet[24759]: E0917 18:14:33.696017   24759 kubelet.go:2422] "Error getting node" err="node \"controlplane\" not found"
Sep 17 18:14:33 controlplane kubelet[24759]: E0917 18:14:33.797095   24759 kubelet.go:2422] "Error getting node" err="node \"controlplane\" not found"
Sep 17 18:14:33 controlplane kubelet[24759]: E0917 18:14:33.897713   24759 kubelet.go:2422] "Error getting node" err="node \"controlplane\" not found"
Sep 17 18:14:33 controlplane kubelet[24759]: E0917 18:14:33.998242   24759 kubelet.go:2422] "Error getting node" err="node \"controlplane\" not found"
Sep 17 18:14:34 controlplane kubelet[24759]: E0917 18:14:34.099246   24759 kubelet.go:2422] "Error getting node" err="node \"controlplane\" not found"
Sep 17 18:14:34 controlplane kubelet[24759]: E0917 18:14:34.200048   24759 kubelet.go:2422] "Error getting node" err="node \"controlplane\" not found"
Sep 17 18:14:34 controlplane kubelet[24759]: E0917 18:14:34.300618   24759 kubelet.go:2422] "Error getting node" err="node \"controlplane\" not found"
Sep 17 18:14:34 controlplane kubelet[24759]: E0917 18:14:34.400929   24759 kubelet.go:2422] "Error getting node" err="node \"controlplane\" not found"

I also restarted the containerd like so systemctl restart containerd
And now I see other errors in the kubelet deamon

Sep 17 18:21:07 controlplane kubelet[64274]: E0917 18:21:07.289903   64274 remote_runtime.go:209] "RunPodSandbox from runtime service failed" err="rpc error: code = Unknown desc = failed to start sandbox container for pod \"kube-apiserver-controlplane\": Error response from daemon: OCI runtime create failed: container_linux.go:367: starting container process caused: exec: \"/pause\": stat /pause: no such file or directory: unknown"
Sep 17 18:21:07 controlplane kubelet[64274]: E0917 18:21:07.289967   64274 kuberuntime_sandbox.go:70] "Failed to create sandbox for pod" err="rpc error: code = Unknown desc = failed to start sandbox container for pod \"kube-apiserver-controlplane\": Error response from daemon: OCI runtime create failed: container_linux.go:367: starting container process caused: exec: \"/pause\": stat /pause: no such file or directory: unknown" pod="kube-system/kube-apiserver-controlplane"
Sep 17 18:21:07 controlplane kubelet[64274]: E0917 18:21:07.289985   64274 kuberuntime_manager.go:832] "CreatePodSandbox for pod failed" err="rpc error: code = Unknown desc = failed to start sandbox container for pod \"kube-apiserver-controlplane\": Error response from daemon: OCI runtime create failed: container_linux.go:367: starting container process caused: exec: \"/pause\": stat /pause: no such file or directory: unknown" pod="kube-system/kube-apiserver-controlplane"
Sep 17 18:21:07 controlplane kubelet[64274]: E0917 18:21:07.290040   64274 pod_workers.go:918] "Error syncing pod, skipping" err="failed to \"CreatePodSandbox\" for \"kube-apiserver-controlplane_kube-system(d17a3babd6a488b35ad66f8fe3a6164b)\" with CreatePodSandboxError: \"Failed to create sandbox for pod \\\"kube-apiserver-controlplane_kube-system(d17a3babd6a488b35ad66f8fe3a6164b)\\\": rpc error: code = Unknown desc = failed to start sandbox container for pod \\\"kube-apiserver-controlplane\\\": Error response from daemon: OCI runtime create failed: container_linux.go:367: starting container process caused: exec: \\\"/pause\\\": stat /pause: no such file or directory: unknown\"" pod="kube-system/kube-apiserver-controlplane" podUID=d17a3babd6a488b35ad66f8fe3a6164b
Sep 17 18:21:07 controlplane kubelet[64274]: E0917 18:21:07.377802   64274 remote_runtime.go:209] "RunPodSandbox from runtime service failed" err="rpc error: code = Unknown desc = failed to start sandbox container for pod \"etcd-controlplane\": Error response from daemon: OCI runtime create failed: container_linux.go:367: starting container process caused: exec: \"/pause\": stat /pause: no such file or directory: unknown"
Sep 17 18:21:07 controlplane kubelet[64274]: E0917 18:21:07.377855   64274 kuberuntime_sandbox.go:70] "Failed to create sandbox for pod" err="rpc error: code = Unknown desc = failed to start sandbox container for pod \"etcd-controlplane\": Error response from daemon: OCI runtime create failed: container_linux.go:367: starting container process caused: exec: \"/pause\": stat /pause: no such file or directory: unknown" pod="kube-system/etcd-controlplane"
Sep 17 18:21:07 controlplane kubelet[64274]: E0917 18:21:07.377871   64274 kuberuntime_manager.go:832] "CreatePodSandbox for pod failed" err="rpc error: code = Unknown desc = failed to start sandbox container for pod \"etcd-controlplane\": Error response from daemon: OCI runtime create failed: container_linux.go:367: starting container process caused: exec: \"/pause\": stat /pause: no such file or directory: unknown" pod="kube-system/etcd-controlplane"
Sep 17 18:21:07 controlplane kubelet[64274]: E0917 18:21:07.377915   64274 pod_workers.go:918] "Error syncing pod, skipping" err="failed to \"CreatePodSandbox\" for \"etcd-controlplane_kube-system(bfa2dd4549e134b47d81123e3072c551)\" with CreatePodSandboxError: \"Failed to create sandbox for pod \\\"etcd-controlplane_kube-system(bfa2dd4549e134b47d81123e3072c551)\\\": rpc error: code = Unknown desc = failed to start sandbox container for pod \\\"etcd-controlplane\\\": Error response from daemon: OCI runtime create failed: container_linux.go:367: starting container process caused: exec: \\\"/pause\\\": stat /pause: no such file or directory: unknown\"" pod="kube-system/etcd-controlplane" podUID=bfa2dd4549e134b47d81123e3072c551
Sep 17 18:21:07 controlplane kubelet[64274]: E0917 18:21:07.381121   64274 kubelet.go:2422] "Error getting node" err="node \"controlplane\" not found"
Sep 17 18:21:07 controlplane kubelet[64274]: E0917 18:21:07.383507   64274 remote_runtime.go:209] "RunPodSandbox from runtime service failed" err="rpc error: code = Unknown desc = failed to start sandbox container for pod \"kube-scheduler-controlplane\": Error response from daemon: OCI runtime create failed: container_linux.go:367: starting container process caused: exec: \"/pause\": stat /pause: no such file or directory: unknown"
Sep 17 18:21:07 controlplane kubelet[64274]: E0917 18:21:07.383558   64274 kuberuntime_sandbox.go:70] "Failed to create sandbox for pod" err="rpc error: code = Unknown desc = failed to start sandbox container for pod \"kube-scheduler-controlplane\": Error response from daemon: OCI runtime create failed: container_linux.go:367: starting container process caused: exec: \"/pause\": stat /pause: no such file or directory: unknown" pod="kube-system/kube-scheduler-controlplane"
Sep 17 18:21:07 controlplane kubelet[64274]: E0917 18:21:07.383576   64274 kuberuntime_manager.go:832] "CreatePodSandbox for pod failed" err="rpc error: code = Unknown desc = failed to start sandbox container for pod \"kube-scheduler-controlplane\": Error response from daemon: OCI runtime create failed: container_linux.go:367: starting container process caused: exec: \"/pause\": stat /pause: no such file or directory: unknown" pod="kube-system/kube-scheduler-controlplane"
Sep 17 18:21:07 controlplane kubelet[64274]: E0917 18:21:07.383620   64274 pod_workers.go:918] "Error syncing pod, skipping" err="failed to \"CreatePodSandbox\" for \"kube-scheduler-controlplane_kube-system(233effdc8fccb749f537f2acea5a7295)\" with CreatePodSandboxError: \"Failed to create sandbox for pod \\\"kube-scheduler-controlplane_kube-system(233effdc8fccb749f537f2acea5a7295)\\\": rpc error: code = Unknown desc = failed to start sandbox container for pod \\\"kube-scheduler-controlplane\\\": Error response from daemon: OCI runtime create failed: container_linux.go:367: starting container process caused: exec: \\\"/pause\\\": stat /pause: no such file or directory: unknown\"" pod="kube-system/kube-scheduler-controlplane" podUID=233effdc8fccb749f537f2acea5a7295
Sep 17 18:21:07 controlplane kubelet[64274]: E0917 18:21:07.400168   64274 remote_runtime.go:209] "RunPodSandbox from runtime service failed" err="rpc error: code = Unknown desc = failed to start sandbox container for pod \"kube-controller-manager-controlplane\": Error response from daemon: OCI runtime create failed: container_linux.go:367: starting container process caused: exec: \"/pause\": stat /pause: no such file or directory: unknown"
Sep 17 18:21:07 controlplane kubelet[64274]: E0917 18:21:07.400229   64274 kuberuntime_sandbox.go:70] "Failed to create sandbox for pod" err="rpc error: code = Unknown desc = failed to start sandbox container for pod \"kube-controller-manager-controlplane\": Error response from daemon: OCI runtime create failed: container_linux.go:367: starting container process caused: exec: \"/pause\": stat /pause: no such file or directory: unknown" pod="kube-system/kube-controller-manager-controlplane"
Sep 17 18:21:07 controlplane kubelet[64274]: E0917 18:21:07.400254   64274 kuberuntime_manager.go:832] "CreatePodSandbox for pod failed" err="rpc error: code = Unknown desc = failed to start sandbox container for pod \"kube-controller-manager-controlplane\": Error response from daemon: OCI runtime create failed: container_linux.go:367: starting container process caused: exec: \"/pause\": stat /pause: no such file or directory: unknown" pod="kube-system/kube-controller-manager-controlplane"
Sep 17 18:21:07 controlplane kubelet[64274]: E0917 18:21:07.400300   64274 pod_workers.go:918] "Error syncing pod, skipping" err="failed to \"CreatePodSandbox\" for \"kube-controller-manager-controlplane_kube-system(9fbce1211115f84f542b8c91fb31ce00)\" with CreatePodSandboxError: \"Failed to create sandbox for pod \\\"kube-controller-manager-controlplane_kube-system(9fbce1211115f84f542b8c91fb31ce00)\\\": rpc error: code = Unknown desc = failed to start sandbox container for pod \\\"kube-controller-manager-controlplane\\\": Error response from daemon: OCI runtime create failed: container_linux.go:367: starting container process caused: exec: \\\"/pause\\\": stat /pause: no such file or directory: unknown\"" pod="kube-system/kube-controller-manager-controlplane" podUID=9fbce1211115f84f542b8c91fb31ce00
Sep 17 18:21:07 controlplane kubelet[64274]: E0917 18:21:07.482136   64274 kubelet.go:2422] "Error getting node" err="node \"controlplane\" not found"
Sep 17 18:21:07 controlplane kubelet[64274]: E0917 18:21:07.582654   64274 kubelet.go:2422] "Error getting node" err="node \"controlplane\" not found"
Sep 17 18:21:07 controlplane kubelet[64274]: E0917 18:21:07.584162   64274 controller.go:144] failed to ensure lease exists, will retry in 7s, error: Get "https://controlplane:6443/apis/coordination.k8s.io/v1/namespaces/kube-node-lease/leases/controlplane?timeout=10s": dial tcp 10.40.202.12:6443: connect: connection refused
Sep 17 18:21:07 controlplane kubelet[64274]: I0917 18:21:07.613858   64274 pod_container_deletor.go:79] "Container not found in pod's containers" containerID="b397d09cc0604b7c8765259d6d750d5f7432baac1cb478776ffc660b4dabc41b"
Sep 17 18:21:07 controlplane kubelet[64274]: I0917 18:21:07.624285   64274 pod_container_deletor.go:79] "Container not found in pod's containers" containerID="c7b90e63bfebfe4ec054088015596557dcbf25157a629d976ce4ca389f9bb4d1"
Sep 17 18:21:07 controlplane kubelet[64274]: I0917 18:21:07.682320   64274 pod_container_deletor.go:79] "Container not found in pod's containers" containerID="d8b781eca307739e2946206423300c111f0d2c439de295799138d185e91f5e98"
Sep 17 18:21:07 controlplane kubelet[64274]: E0917 18:21:07.682793   64274 kubelet.go:2422] "Error getting node" err="node \"controlplane\" not found"
Sep 17 18:21:07 controlplane kubelet[64274]: I0917 18:21:07.695091   64274 pod_container_deletor.go:79] "Container not found in pod's containers" containerID="5ccccc48e3e9997964154a19f8001779059315bcf89af3c968f09f28b3fea500"
Sep 17 18:21:07 controlplane kubelet[64274]: E0917 18:21:07.782853   64274 kubelet.go:2422] "Error getting node" err="node \"controlplane\" not found"
Sep 17 18:21:07 controlplane kubelet[64274]: E0917 18:21:07.882984   64274 kubelet.go:2422] "Error getting node" err="node \"controlplane\" not found"
Sep 17 18:21:07 controlplane kubelet[64274]: I0917 18:21:07.928303   64274 kubelet_node_status.go:70] "Attempting to register node" node="controlplane"
Sep 17 18:21:07 controlplane kubelet[64274]: E0917 18:21:07.928692   64274 kubelet_node_status.go:92] "Unable to register node with API server" err="Post \"https://controlplane:6443/api/v1/nodes\": dial tcp 10.40.202.12:6443: connect: connection refused" node="controlplane"
Sep 17 18:21:07 controlplane kubelet[64274]: E0917 18:21:07.984015   64274 kubelet.go:2422] "Error getting node" err="node \"controlplane\" not found"
Sep 17 18:21:08 controlplane kubelet[64274]: E0917 18:21:08.084778   64274 kubelet.go:2422] "Error getting node" err="node \"controlplane\" not found"
Sep 17 18:21:08 controlplane kubelet[64274]: E0917 18:21:08.184940   64274 kubelet.go:2422] "Error getting node" err="node \"controlplane\" not found"
^C

What am I doing wrong ? :face_with_peeking_eye:

Hey folks, I just wanted to let you know that this is working now. I just started over the challenge, followed the suggestions in github and it worked now.
thanks