Certified Kubernetes Application Developer (CKAD) Mock Exam Series Exam 4 - Why was this flagged false?

Hello,
the task was to create a cronjob to print text every beginning of the hour. Every subtask of cronjob creation was correct but “command executed correctly”.
This was the solution:

spec: 
containers: 
- name: learning-every-hour 
   image: alpine 
   imagePullPolicy: IfNotPresent 
   command: 
     - /bin/sh 
     -  -c 
     - echo I will pass CKAD certification 
    restartPolicy: OnFailure

This was my approach, which always worked in other mock exams:

spec: 
   containers: 
    - args: 
        - -c 
        - echo I will pass CKAD certification 
       command: 
        - /bin/sh 
       image: alpine 
       imagePullPolicy: Always 
       name: learning-every-hour

The heck? Am I missing something? The image pull policy was a byproduct by using imperative commands but since the validator explicitly marked the command as false, i doubt this is the reason.

Whether your solution would work or not would depend upon what command (if any) the alpine image is configured with. Why not use command instead, where you can be sure that the ‘-c’ argument is actually relevant to how that image is configured? It might work, but the syntax is unusual enough that it might throw the grader off track.

1 Like

On second inspection – I think your indentation is wrong. args is more indented than the rest of the container’s parameters.

The indentation was broken when copying this to the forum. Thanks for the heads up, i will just use command: [“/bin/sh”,“-c”,command] for future tasks