Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

K8s DaemonSet stills restart

Im starting with K8s and I have problem with my DaemonSet resource. When I apply it, it goes to Running state, then Completed and then CrashLoopBackOff and then again to running etc. I would like to have all my pods to be in Running state. Here is my manifest:

apiVersion: apps/v1
kind: DaemonSet
metadata:
  name: ds-test
  labels:
    app: busybox-ds
spec:
  selector:
    matchLabels:
      name: busybox-ds
  updateStrategy:
    type: RollingUpdate
    rollingUpdate:
      maxUnavailable: 0
      maxSurge: 3
  template:
    metadata:
      labels:
        name: busybox-ds
    spec:
      containers:
      - name: busybox-ds
        image: busybox

Could somebody tell me what am I doing wrong?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

The busybox image just runs sh as its command. If it’s not being interacted with, it immediately exits, and hence why you see your pod go to the Completed state.

You need to have that image run a command that will keep its process running.

Using tail -f /dev/null is a common way to do this. So your manifest would look like:

    spec:
      containers:
      - name: busybox-ds
        image: busybox
        command:
        - tail
        - -f
        - /dev/null
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading