Why is there `sleep infinity` in the kubernetes yaml file for spark

6/15/2017

I am reading this blog and tried to run the code. If sleep infinity is removed, the pod will be stuck in CrashLoopBackOff:

$ 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

Can anyone explain this?

-- BAE
apache-spark
kubernetes
minikube

2 Answers

6/16/2017

yes, since you removed the sleep infinity, container is starting and terminating. you need to keep sleep statement. Is there a reason you want to remove sleep?

Thanks SR

-- sfgroups
Source: StackOverflow

6/16/2017

The reason the pod goes into the CrashLoopBackOff state is that Kubernetes expects to process manage the command executed by the container. Presumably the start-master.sh 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 sleep infinity is included to simulate a long running process. You could also achieve this with something like:

'./start-master.sh ; /bin/bash'

-- Keyan P
Source: StackOverflow