CKAD Mock Exam 1 Question

Could someone help me out? For the simple-python-job cronjob question, I am getting the question wrong and I do not know why. Comparing my yaml to the solution, I am unable to distinguish a difference. The error says that I have the wrong command.

Here is my yaml file

apiVersion: batch/v1
kind: CronJob
metadata:
  creationTimestamp: null
  name: simple-python-job
  namespace: ckad-job
spec:
  jobTemplate:
    metadata:
      creationTimestamp: null
      name: simple-python-job
    spec:
      template:
        metadata:
          creationTimestamp: null
        spec:
          containers:
          - image: python
            name: simple-python-job
            command: ['/bin/sh', '-c', 'ps -eaf']
            resources: {}
          restartPolicy: OnFailure
  schedule: "*/30 * * * *"
status: {}

HI @reggie.d.hayes
Please provide us the link to the labs

Thanks in advance

Have you taken a look?

Hi @reggie.d.hayes,
Sorry for the late as the task is random, he take some time to fine it :slight_smile:

Just testing and it’s works fine

on command section try to do as following

command:
- /bin/sh
- -c
- ps –eaf

Regard

@mmkmou_KodeKloud
Even I faced the same problem. the definition is same for me. But the solution is invalidated.

We could define this in either commnd or args right?

command:

  • /bin/sh
  • -c
  • ps –eaf

args:

  • /bin/sh
  • -c
  • ps –eaf

Having the exact same issue. I have the exact same yaml definition file but for some reason it doesn’t validation check doesn’t pass. My yaml file for reference.

Hi @shanmugam.saravanan
Sorry for the late response, prefer use command

@ericng1077,

Your yaml file seems like correct. Can you, please provide us the detail of failed validation?

Regard

All the validations passed except for “cronjob runs the desired command”

I actually ran into the question again and am still not able to valide it.

However, if I copy/paste the definition file in the solution the validation check passes. Not sure why though…

this is the code I am using it. but everytime invalidates on this “Does cronjob run ps –eaf command?”

Hi @shanmugam.saravanan
You are created it on the right namespace. You need to create it on namespace ckad-job

Regard

@mmkmou I was running in the corrrect namespace only and but the answer is not validating correctly. Please refer the attached document
image
image
image

Hi @shanmugam.saravanan

Same as below you need to create the cronjob on the right namespace you create it on default namespace he should be on ckad-job

@mmkmou I created the cron job in the correct namespace ckad-job. I think you are referring my local yaml file and mentioning there is no namespace defined.

Please refer my all the screenshots that clearly shows my job was running in the right namespace. I set the context with correct namespace and used the yaml file. so the cron job is running in the correct namespace. It’s not validated correctly it seems as I don’t any issue here

@mmkmou
Have you had a chance to look into this as the same issue persists when I tried multiple times. Please refer the another screenshot


image

1 Like

Hi, if it still interests you - or anyone else, who might have this problem - your solution is good.
Have a look at the ps -eaf command.
The - sign in the suggested solution is wrong, it is not the minus sign, but an en dash.
Compare
ps –eaf / wrong
ps -eaf / right
If you paste into your solution the command from the suggestion:
In Python, ps –eaf can be use to list all the running processes.
It will be green, but wrong.

I have observed is one of the (repetitive) question where the solution expects a certain format in command, if it’s not met your task is graded incomplete even though the command + arguments works.

You are right. I have raised and internal ticket to get this looked at.

You actually need to copy the dash from the failure message and paste that into vi instead of regular minus.

1 Like