Lab-ckad-mock-exam - Exam Solution

I have been trying to solve this question:

Question:

SECTION: APPLICATION DESIGN AND BUILD

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

kubectl config use-context cluster1

In the ckad-job namespace, schedule a job called learning-every-minute that prints this message in the shell every minute: I am practicing for CKAD certification.
In case the container in pod failed for any reason, it should be restarted automatically.
Use busybox:1.28 image for the cronjob!

I had provided this answer:

apiVersion: batch/v1
kind: CronJob
metadata:
creationTimestamp: null
name: learning-every-minute
namespace: ckad-job
spec:
jobTemplate:
metadata:
creationTimestamp: null
name: learning-every-minute
spec:
template:
metadata:
creationTimestamp: null
spec:
containers:
- command:
- sh
- -c
- echo “I am practicing for CKAD certification”
image: busybox:1.28
name: learning-every-minute
resources: {}
restartPolicy: OnFailure
schedule: ‘*/1 * * * *’
status: {}
~

But the system evaluated it as wrong, and provided me this solution:

apiVersion: batch/v1
kind: CronJob
metadata:
namespace: ckad-job
name: learning-every-minute
spec:
schedule: “* * * * *”
jobTemplate:
spec:
template:
spec:
containers:
- name: learning-every-minute
image: busybox:1.28
imagePullPolicy: IfNotPresent
command:
- /bin/sh
- -c
- echo I am practicing for CKAD certification
restartPolicy: OnFailure

I am not sure about the difference between these two, as I am getting the required output when i check the pod logs. Could someone please help understand this?

This is where the system says i made a mistake:

Does cronjob run required command?

Does cronjob run every minute?

First, if you include YAML in your answer, make sure you use the </> button to create a code block

So your code does not
  - get garbled
  - get its indentation changed
  - quote marks don't get changed
     - "'"
     - '"'

I’m not 100% sure what your answer was due to this; but as far as I can tell, your answer should be allowed by the grader code, since

  • * * * * * and */1 * * * * are equivalent
  • your command is equivalent; quoting should not matter.

I’ll report your question to our lab team; it should be fixed to allow your answer. You should probably fix your YAML before I do that, though, since the lab team will need to check your answer.