Why my answer on this questions is always incorrect?

i have attempted below questions many times but always it is incorrect.

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

kubectl config use-context cluster1

In the ckad-multi-containers namespace, create a pod named tres-containers-pod, which has 3 containers matching the below requirements:

  • The first container named primero runs busybox:1.28 image and has ORDER=FIRST environment variable.

  • The second container named segundo runs nginx:1.17 image and is exposed at port 8080.

  • The last container named tercero runs busybox:1.31.1 image and has ORDER=THIRD environment variable.

Note: I find my answer is correct by still it always shows incorrect and demotivates me. Kindly help. below is my answer in code:

`apiVersion: v1
kind: Pod
metadata:
creationTimestamp: null
labels:
run: tres-containers-pod
name: tres-containers-pod
namespace: ckad-multi-containers
spec:
containers:

  • image: nginx:1.17
    name: segundo
    ports:
    • containerPort: 8080
      resources: {}
  • image: busybox:1.28
    name: primero
    command: [“sh”,“-c”,“sleep 3600”]
    env:
    - name: ORDER
    value: FIRST
    resources: {}
  • image: busybox:1.31.1
    name: tercero
    command: [“sh”,“-c”,“sleep 3600”]
    env:
    - name: ORDER
    value: THIRD
    resources: {}
    dnsPolicy: ClusterFirst
    restartPolicy: Always
    status: {}`

@himanshuaggarwal98 you gotta learn to format your code so we can investigate these things. Steps are:

  • Press the “</>” button.
  • Enter your code in the area it tells you to enter it.

Otherwise, your code gets garbled, as it currently is. I can’t tell if the mistake is in your code as intended, or what Discourse does to your code after you enter it.

I’m guessing that this comes from the Ultimate CKAD Mock Exams (you should say this in your question too). If it is, you can find the answer in the final screen you get when you END THE EXAM. I can help you find why things don’t work if you include the solution you get from that screen, and you format the code using the “</>” button as I suggest.

Hi Rob,

I can take care of indentation error because pod won’t run otherwise.

My pods are running sucessfully and i validated all details these are correct. Need your help to understand where my answer is different than what was asked in question?

Do you think that i missed anything in answer? if not, do you believe there is any issue with mock test terminal/clusters?

Unless I can figure out the actual indentation of your code, it’s hard to know. It’s really essential for getting help with these things.

My solution, you can compare it with yours and see if this works for you!

You can also remove the [“sh”,“-c”,“] since sleep is just a basic command…

himanshuaggarwal98

In your example segundo is a first container but must be a second

So it should be something like

apiVersion: v1
kind: Pod
metadata:
  name: tres-containers-pod
  namespace: ckad-multi-containers
  labels:
    run: tres-containers-pod
spec:
  containers:
  - name: primero
    image: busybox:1.28
    command: ["sh","-c","sleep 3600"]
    env:
    - name: ORDER
      value: FIRST
  - name: segundo
    image: nginx:1.17
    ports:
      containerPort: 8080
  - name: tercero
    image: busybox:1.31.1
    command: ["sh","-c","sleep 3600"]
    env:
    - name: ORDER
      value: THIRD

P.S.
order matters