Kubernetes Challenge 2

Hi folks.
I am working in Kubernetes Challenge 2 and I am really stuck with this


I tried with many different things but I cannot get this fixed.
Could you please help me how can I proceed?.

Hi @matias.saracusti ,
Please check our kubernetes-challenges GitHub repo for the solution.

If you are still facing an issue after going through the solution then let me know.

Regards,
KodeKloud Support

Thanks a lot Tej-Sing-Rana. I was following the same procedure but it seems not in the correct order. It worked properly. Thanks again.

Hi Tej,

In the lab I was working on. I made the changes to the CA file name in the kube-apiserver.yaml, however my API server didn’t start. I then looked with docker ps I could not see a container for kube-apiserver. IS that correct? Am I missing something?

Hi @rajeev.ramani

Is your question related to the Kubernetes Challenges? If not, could you post a new topic stating which lab in which course, and we’ll pick it up from there.

Thanks.

Hi @Alistair_KodeKloud yes it is related to kubernetes challenge. Its the lab 2 in the challenge. My expectation was that one you correct the path for the certificate file the apiserver would come up but it does not. I am not sure what I am missing.

Hi @rajeev.ramani

I have just run through that step. The three parts to it run as follows. I did them in reverse order so that the tools you need are working when you need them

  • Fix kubeconfig - Edit .kube/config and fix the port number
  • Fix the API server - Edit the static manifest for kube-apiserver and correct the name of the client-ca-file. Monitor for the new API server pod starting with docker ps. When it has been running for some seconds, then you should be able to run kubectl get pods -n kube-system and see that it is fixed.
  • Fix coredns by doing kubectl edit deployment -n kube-system coredns and correcting the image name.

Hope this helps

Thanks, @Alistair_KodeKloud unfortunately a new API server does not get created. I have tried your way as well.

Here’s the detailed instructions

  1. Fix kubeconfig
vi .kube/config

Change

  server: https://controlplane:6433

to

  server: https://controlplane:6443
  1. Fix apiserver
vi /etc/kubernetes/manifests/kube-apiserver.yaml

Change

    - --client-ca-file=/etc/kubernetes/pki/ca-authority.crt

to

    - --client-ca-file=/etc/kubernetes/pki/ca.crt
  1. Monitor for api server starting
watch docker ps

You should shortly see something like this

CONTAINER ID        IMAGE                  COMMAND                  CREATED             STATUS              PORTS               NAMES
c9e7775cae42        e6bf5ddd4098           "kube-apiserver --ad…"   14 seconds ago      Up 13 seconds                           k8s_kube-apiserver_kube-apiserver-controlplane_kube-system_d1871f4c35391f61668ca9577db4aed3_0

If after about 30 seconds it has not started, then do this and re-run the above watch

systemctl restart kubelet
  1. Fix coredns
kubectl edit deployments.apps -n kube-system coredns

Change

        image: k8s.gcr.io/kubedns:1.3.1

to

        image: k8s.gcr.io/coredns/coredns:v1.8.6
  1. Wait for old coredns pods to terminate
watch kubectl get pods -n kube-system
  1. Press check button. Controlplane icon should now go green
4 Likes

Apologies for late reply @rajeev.ramani . My broadband was down nearly the whole day yesterday due to overrunning scheduled maintenance by my provider in my area.

Thanks I did complete up to step 4 which includes restart kubelet. May be it took time I will try it again. Thanks for the quick response.

I ran the scenario several times. Sometimes a kubelet restart was required. I have reported this to the team.

1 Like

The first part users does not show green and also it is not clear what is to be done to resolve the issue and make it green. The solution mentioned above or in the github https://github.com/kodekloudhub/kubernetes-challenges/tree/master/challenge-2 does not mention with clarity what is required to fix it. Highlighting the issue as this is not related to kubelet service restart to my understanding


.

Hi @srinivasons
The task you are missing is the red arrow from users. Click on that to reveal

1 Like

I did exactly how it’s in the example. And it says, that:

  • Create a pod for fileserver, name: ‘gop-fileserver’

  • pod: gop-fileserver image: ‘kodekloud/fileserver’

  • pod: gop-fileserver mountPath: ‘/web’

  • pod: gop-fileserver volumeMount name: ‘data-store’

  • pod: gop-fileserver persistent volume name: data-store

  • pod: gop-fileserver persistent volume claim used: ‘data-pvc’

However, I copied example from the github repo
POD is running

Found the problem — we must create a POD in default namespace. However, it wasn’t noticed

The Users part implies the service needs to be exposed as a NodePort.

Thank you for this; is there a part of the CKAD course I can look at to review this stuff, or is it beyond CKAD?

Hi @nic.thorne

Fixing the API server is actually a CKA topic. You won’t get a question like that in CKAD.

1 Like

For challenge 2, where is nodePort: 31200 coming from??