<p>I am using busybox container to understand kubernetes concepts.
but if run a simple <code>test-pod.yaml</code> with busy box image, it is in completed state instead of running state
can anyone explain the reason</p>
<pre><code>apiVersion: v1
kind: Pod
metadata:
  name: dapi-test-pod
spec:
  containers:
    - name: test-container
      image: k8s.gcr.io/busybox
      command: [ &quot;/bin/sh&quot;, &quot;-c&quot;, &quot;ls /etc/config/&quot; ]
      volumeMounts:
      - name: config-volume
        mountPath: /etc/config
  volumes:
    - name: config-volume
      configMap:
        # Provide the name of the ConfigMap containing the files you want
        # to add to the container
        name: special-config
  restartPolicy: Never
</code></pre>

Rajendar Talatam
<p>Look, you should understand the basic concept here. Your docker container will be running till its main process is live. And it will be completed as soon as your main process  will stop.</p>
<p>Going step-by-step in your case:
You launch <code>busybox</code> container with main process <code>&quot;/bin/sh&quot;, &quot;-c&quot;, &quot;ls /etc/config/&quot;</code> and obviously this process has the end. Once command is completed and you listed directory - your process throw <code>Exit:0 status</code>, container stop to work and you see completed pod as a result.</p>
<p>If you want to run container longer, you should explicitly run some command inside the main process, that will keep your container running as long as you need.</p>
<p>Possible solutions</p>
<ul>
<li><p>@Daniel's answer -  container will execute <code>ls /etc/config/</code> and will stay alive additional 3600 sec</p>
</li>
<li><p>use <code>sleep infinity</code> option. Please be aware that there was a long time ago issue, when this option hasn't worked properly exactly with busybox. That was fixed  in 2019, more information <a href="https://bugs.busybox.net/show_bug.cgi?id=11586" rel="nofollow noreferrer">here</a>. Actually this is not INFINITY loop, however it should be enough for any testing purpose. You can find huge explanation in <a href="https://stackoverflow.com/a/59596857/9929015">Bash: infinite sleep (infinite blocking)</a> thread</p>
</li>
</ul>
<p>Example:</p>
<pre><code>apiVersion: v1
kind: Pod
metadata: 
  name: busybox-infinity
spec: 
  containers: 
    - 
      command: 
        - /bin/sh
        - &quot;-c&quot;
        - &quot;ls /etc/config/&quot;
        - &quot;sleep infinity&quot;
      image: busybox
      name: busybox-infinity
</code></pre>
<ul>
<li>you can use different varioations of while loops, tailing and etc etc. That only rely on your imagination and needs.</li>
</ul>
<p>Examples:</p>
<pre><code>[&quot;sh&quot;, &quot;-c&quot;, &quot;tail -f /dev/null&quot;]

command: [&quot;/bin/sh&quot;]
args: [&quot;-c&quot;, &quot;while true; do echo hello; sleep 10;done&quot;]

command: [ &quot;/bin/bash&quot;, &quot;-c&quot;, &quot;--&quot; ]
args: [ &quot;while true; do sleep 30; done;&quot; ]
</code></pre>
