<p>I am trying out mock exams on udemy and have created a multi container pod . but exam result says command is not set correctly on container <code>test2</code> .I am not able to identify the issue.</p>
<pre><code>apiVersion: v1
kind: Pod
metadata:
  creationTimestamp: null
  labels:
    run: multi-pod
  name: multi-pod
spec:
  containers:
  - image: nginx
    name: test1
    env:
     - name: type
       value: demo1
  - image: busybox
    name: test2
    env:
     - name: type
        value: demo2
    command: [&quot;sleep&quot;, &quot;4800&quot;]
</code></pre>

coder25
<p>An easy way to do this is by using imperative kubectl command to generate the yaml for a single container and edit the yaml to add the other container</p>
<pre><code>kubectl run nginx --image=nginx --command -oyaml --dry-run=client -- sh -c 'sleep 1d' &gt; nginx.yaml
</code></pre>
<p>In this example <code>sleep 1d</code> is the command.</p>
<p>The generated yaml looks like below.</p>
<pre><code>apiVersion: v1
kind: Pod
metadata:
  creationTimestamp: null
  labels:
    run: nginx
  name: nginx
spec:
  containers:
  - command:
    - sh
    - -c
    - sleep 1d
    image: nginx
    name: nginx
    resources: {}
  dnsPolicy: ClusterFirst
  restartPolicy: Always
status: {}
</code></pre>
