CKA - Mock Exam 1 - commands in pods

If I want to create a pod with a command running, such as a busybox with ‘sleep 5000’. I like to do an imperative command, such as “kubectl run example --image=busybox --dry-run=client -o yaml – sleep 5000”, as an easy example.

This produces the following
spec:
containers:

  • args:
    • sleep
    • “5000”
      image: busybox
      name: example

The kubernetes documentation shows:

containers:

  • name: example
    image: busybox
    command: [“sleep”]
    args: [“5000”]

KodeKloud wants the following to be used:

containers:

  • name: example
    image: busybox
    command:
    • sleep
    • “5000”

While these are slightly different on how they are performed on the pod, they essentially do the same thing (correct me if I’m wrong). Is there a specific way to do this according to the CKA? Or does the CKA really just want the results, which is a command ran inside the container, however you choose to do it? I think KodeKloud is being picky, but unsure if CKA is that picky.

I’ve also noticed some other questions are being flagged as the way the YAMLs are created, but the results are the same. Such as editing secret keys instead of editing the deployment. CKA exam would really just make the solution works, yes?

They all work, and there is no “official” way to do it. In an exam situation, you’ll need to analyze the wording of the question to know what they want. If the question uses the word “command”, they probably want the command version. Sometimes they just want you to sleep the busybox for a given amount of time, and typically in these cases, the grader will allow either the args or commands version. Using both command and args? THAT IS JUST GAUCHE.

Yeah I agree with you, they all work (along other multiple ways to achieve a solution in kubernetes) To your point, perhaps I’d have to read the mock exam question a bit more carefully. But if it’s generic, I’d imagine the exam would take the response that works. Thanks for the reply!