Multi container pod - Mock exam question

The question is:
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 OR-DER=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 OR-DER=THIRD environment variable.

NOTE: All pod containers should be in the running state.
• Is the primero container running?
• Is the primero container use busybox:1.28 image?
• Is the primero container environment variable well configured?
• Does the segundo container running?
• Does the segundo container use nginx:1.17 image?
• Is the segundo container expose at port 8080?
• Is the tercero container running?
• Is the tercero container use busybox:1.31.1 image?
• Is the tercero container environment variable well configured?

And the recommended solution is:

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

  • env:
    • name: ORDER
      value: FIRST
      image: busybox:1.28
      name: primero
      command:
    • /bin/sh
    • -c
    • sleep 3600;
      resources: {}
  • image: nginx:1.17
    name: segundo
    ports:
    • containerPort: 8080
      resources: {}
  • env:
    • name: ORDER
      value: THIRD
      image: busybox:1.31.1
      name: tercero
      command:
    • /bin/sh
    • -c
    • sleep 3600;
      resources: {}
      dnsPolicy: ClusterFirst
      restartPolicy: Always
      status: {}

I would like to know why the following solution not adequate is and why I got a CrashLoopBackOff error.

apiVersion: v1
kind: Pod
metadata:
name: tres-containers-pod
namespace: ckad-multi-containers
spec:
containers:

  • name: primero
    image: busybox:1.28
    env:
    • name: ORDER
      value: “FIRST”
  • name: segundo
    image: nginx:1.17
    ports:
    • containerPort: 8080
  • name: tercero
    image: busybox:1.31.1
    env:
    • name: ORDER
      value: “THIRD”

Can you please post these YAMLs in

code blocks

You have lost all the formatting and indentation which is part of the syntax of YAML, meaning we cannot check it.

apiVersion: v1
kind: Pod
metadata:
  name: tres-containers-pod
  namespace: ckad-multi-containers
spec:
  containers:
  - name: primero
    image: busybox:1.28
    env:
    - name: ORDER
      value: "FIRST"
  - name: segundo
    image: nginx:1.17
    ports:
    - containerPort: 8080
  - name: tercero
    image: busybox:1.31.1
    env:
    - name: ORDER
      value: "THIRD"

You’re missing the command blocks for primero and tercero. These are needed, since busybox will immediately exit if it has nothing to do.

why don´t we need a respective command (like
command:
- /bin/sh
- -c
- sleep 3600;
)
for segundo?

segundo is running nginx which is a server, therefore the pod is doing something and does not exit.