Trying to schedule a simple pod on node03, it keeps crashing. Any pointers why? . . .

Ramit Sharma:
Trying to schedule a simple pod on node03, it keeps crashing. Any pointers why?

apiVersion: v1
kind: Pod
metadata:
creationTimestamp: null
labels:
run: busy
name: busy
spec:
nodeName: node03
containers:

  • image: busybox
    name: busy
    resources: {}
    dnsPolicy: ClusterFirst
    restartPolicy: Always
    status: {}

Fernando Jimenez:
Are you sure it is crashing? Could it be that it runs and it finishes? Please, give busybox something to stick around for, like a sleep command.

apiVersion: v1
kind: Pod
metadata:
  labels:
    run: busy
  name: busy
spec:
  nodeName: node03
  containers:
  - image: busybox
    name: busy
    command:
    - sleep
    - "3600"

Ramit Sharma:
you are correct, sleep 1000 solves the problem. But what I dont understand is that status of the yaml above came as crashbackloop.

Fernando Jimenez:
When the pod runs without any command it runs as a sh and it exits. Since the default is to keep the container alive, it is eventually marked as CrashLoopBackOff
Now, if you were to instruct it to not try to restart, then this is what you’ll see.

$ kubectl run busy --image=busybox --restart=Never
pod/busy created
$ kubectl get pod
NAME   READY   STATUS      RESTARTS   AGE
busy   0/1     Completed   0          3s

Ramit Sharma:
That helps, thanks a lot.