<p>I am reading <a href="http://blog.madhukaraphatak.com/scaling-spark-with-kubernetes-part-6/" rel="nofollow noreferrer">this blog</a> and tried to run the <a href="https://github.com/phatak-dev/kubernetes-spark" rel="nofollow noreferrer">code</a>. If <code>sleep infinity</code> is removed, the pod will be stuck in CrashLoopBackOff:</p>

<pre><code>$ kubectl get po
NAME                            READY     STATUS             RESTARTS   AGE
spark-master-715509916-zggtc    0/1       CrashLoopBackOff   5          3m
spark-worker-3468022965-xb5mw   0/1       Completed          5          3m
</code></pre>

<p>Can anyone explain this?</p>

<p>The reason the pod goes into the <code>CrashLoopBackOff</code> state is that Kubernetes expects to process manage the command executed by the container. Presumably the <code>start-master.sh</code> script executes, then exits, which Kubernetes interprets as the process dying. You need to execute a command which will not exit in order to keep the pod alive. In this case the <code>sleep infinity</code> is included to simulate a long running process. You could also achieve this with something like:</p>

<p><code>'./start-master.sh ; /bin/bash'</code></p>
