Mock Exam 2 question 6: Create a new pod called `nginx1401` in the `default` nam . . .

dean madani:
mock Exam 2 question 6: Create a new pod called nginx1401 in the default namespace with the image nginx. Add a livenessProbe to the container to restart it if the command ls /var/www/html/probe fails. This check should start after a delay of 10 seconds and run every 60 seconds. ran it but after few minutes seeing the error: Warning Unhealthy 49s (x2 over 109s) kubelet, node02 Liveness probe failed: ls: cannot access ‘/var/www/html/probe’: No such file or directory. the /www is missing. any suggestion? also the solution doesn’t cover this question

Tej_Singh_Rana:
Hello, @dean madani
You’re getting that error because we have to restart the container every 60 seconds.
> Add a livenessProbe to the container to restart it if the command ls /var/www/html/probe fails

dean madani:
that’s what I did, but still going down after 1 minute. why there is no solution video for this.

Mohamed Ayman:
Check the following and ignore the warning:

apiVersion: v1
kind: Pod
metadata:
  labels:
    run: nginx1401
  name: nginx1401
spec:
  containers:
  - image: nginx
    name: nginx1401
    livenessProbe:
      exec:
        command:
        - ls
        - /var/www/html/probe
      initialDelaySeconds: 10
      periodSeconds: 60
    resources: {}
  dnsPolicy: ClusterFirst
  restartPolicy: Never

Mohamed Ayman:
Check this gif:
ckad-mockexam2-q6.gif

dean madani:
that’s what I did and before 1 minutes the test passed but if you wait for more then 1 minute, it will failed. it meaning the exam will show failed

dean madani:
do the same but wait for couple minutes before press End Exam

Tej_Singh_Rana:
Hello, @dean madani
I think because that time the pod gets restarted and so it will take time to up.