I find cluster is not responding correctly

I attempted this question:

For this question, please set the context to cluster1 by running:

kubectl config use-context cluster1

A template to create a Kubernetes pod is stored at /root/probe-ckad-aom.yaml on the student-node. Set the initialDelaySeconds to 5. However, using this template results in an error.

Fix the issue with this template and use it to create the pod. Once created, watch the pod for a minute or two to make sure it is stable i.e., it is not crashing or restarting.

Please tell me if my answer is not correct below:

And i found that my answer is correct but terminal shows that it’s incorrect i re-validated all values. I am not sure what’s wrong with this.

`apiVersion: v1
kind: Pod
metadata:
name: probe-ckad-aom
spec:
containers:

  • name: red-probe-cn-ckad12-trb
    image: busybox:latest
    args:
    • /bin/sh
    • -c
    • sleep 3 ; touch /healthcheck; sleep 30;sleep 30000
      livenessProbe:
      exec:
      command:
      - cat
      - /healthcheck
      initialDelaySeconds: 5
      periodSeconds: 1
      failureThreshold: 1`

This is a little difficult for me to help you with, since I can’t check a JPG for syntactic correctness :slight_smile:

I assume you are doing the CKAD Ultimate Mock Exams here; you should typically say where the problem is from, and if possible, link to it. Also, if you can, rather than give me a JPG of the file, it helps a lot more if you include your code using a code block using the “</>” button, or using triple-single-quotes to set it off, like this:

Your code will be
So much easier to read this way
and can be checked for correctness too!

Hey Rob,

thanks for your reply.

I have updates code in the quotes as you mentioned.

OK, I needed to play with the indentation. Here’s the modified file:

apiVersion: v1
kind: Pod
metadata:
  name: probe-ckad-aom
spec:
  containers:

  - name: red-probe-cn-ckad12-trb
    image: busybox:latest
    args:
    - /bin/sh
    - -c
    - sleep 3 ; touch /healthcheck; sleep 30;sleep 30000
    livenessProbe:
      exec:
        command:
        - cat
        - /healthcheck
      initialDelaySeconds: 5
      periodSeconds: 1
      failureThreshold: 1

I can’t readily test an Ultimate Mock Exam, but at least the above will actually load in a valid pod.

Hi rob,

I just copied and pasted hence yaml was not correct.

But would like to mention that I deployed this and pod was in running state. I validated it twice but still it shows incorrect.

The grader looks for specific points in the code, and it can be opinionated. Sometimes that opinion is open to question :slight_smile: In the Ultimate Mocks, the best way to see what it’s looking for is to look on the final "grading’ screen, and reading the solution blocks for the problems it says you missed. Since it’s hard for me to access the problem (or for you to give me a link, since the questions are randomized), that’s the best I can do for you now.

Hi Rob,

so this is the issue, my pod is running perfectly but in the solution content of yaml is correct too.

However, it still says i missed few things which i can see present in my solution, those are:

  1. initialDelaySeconds: 5
  2. using “exec” in livenessprobe.

i don’t find anything missing in my solution.

Hi @rob_kodekloud

Could you please check what is wrong here?
I have same issue as @himanshuaggarwal98.

Error message compalins about two points

  • Probe type changed to exec ?
  • Initial delay seconds is set to 5 ?

Here is a code and outputs from lab. Please take a note that container is up and running for over 27 minutes, no restarts, healthcheck file is available in the container and cat command works properly.

student-node ~ ➜  cat probe-ckad-aom.yaml 
apiVersion: v1
kind: Pod
metadata:
  name: probe-ckad-aom
spec:
  containers:
  - name: red-probe-cn-ckad12-trb
    image: busybox:latest
    args:
    - /bin/sh
    - -c
    - sleep 3 ; touch /healthcheck; sleep 30;sleep 30000
    livenessProbe:
      exec:
        command:
        - cat
        - /healthcheck
      initialDelaySeconds: 5
      periodSeconds: 1
      failureThreshold: 1


student-node ~ ➜  k get pods
NAME                                READY   STATUS    RESTARTS   AGE
webpage-server-02-5667c8c67-bfkk4   1/1     Running   0          41m
webpage-server-02-5667c8c67-4lxk8   1/1     Running   0          41m
webpage-server-02-5667c8c67-qttt6   1/1     Running   0          41m
probe-ckad-aom                      1/1     Running   0          26m
flash                               1/1     Running   0          26m
fury                                1/1     Running   0          26m
sheldon                             1/1     Running   0          26m
nginx-resolver-ckad03-svcn          1/1     Running   0          6m49s

student-node ~ ➜  k get pods | grep probe
probe-ckad-aom                      1/1     Running   0          27m

student-node ~ ➜  k exec -it probe-ckad-aom -- cat /healthcheck

student-node ~ ➜  k exec -it probe-ckad-aom -- ls -la /
total 48
drwxr-xr-x    1 root     root          4096 Jan 23 15:36 .
drwxr-xr-x    1 root     root          4096 Jan 23 15:36 ..
drwxr-xr-x    2 root     root         12288 Jan 17 21:58 bin
drwxr-xr-x    5 root     root           360 Jan 23 15:36 dev
drwxr-xr-x    1 root     root          4096 Jan 23 15:36 etc
-rw-r--r--    1 root     root             0 Jan 23 15:36 healthcheck
drwxr-xr-x    2 nobody   nobody        4096 Jan 17 21:59 home
drwxr-xr-x    2 root     root          4096 Jan 17 21:58 lib
lrwxrwxrwx    1 root     root             3 Jan 17 21:58 lib64 -> lib
dr-xr-xr-x 3496 root     root             0 Jan 23 15:36 proc
drwx------    2 root     root          4096 Jan 17 21:59 root
dr-xr-xr-x   13 nobody   nobody           0 Jan 23 15:36 sys
drwxrwxrwt    2 root     root          4096 Jan 17 21:59 tmp
drwxr-xr-x    4 root     root          4096 Jan 17 21:59 usr
drwxr-xr-x    1 root     root          4096 Jan 23 15:36 var```