Home > database >  Pod not starting - OCI runtime create failed: runc create failed: unable to start container process
Pod not starting - OCI runtime create failed: runc create failed: unable to start container process

Time:07-16

May be I am missing some basic here. My pod failing at executing the shell command

apiVersion: apps/v1
kind: ReplicaSet
metadata:
  name: redis-rs01
  labels:
    name: redis-rs01
    run: redis-rs01
    app: redis
spec:
  replicas: 3
  selector:
    matchLabels:
      app: redis
  template:
    metadata:
      name: redis
    labels:
      app: redis
    spec:
      volumes:
      - name: vol001
        emptyDir: {}
      containers:
      - name: redis
        image: redis
        ports:
        - containerPort: 6739
        env:
          - name: MY_NODE_NAME
            valueFrom:
              fieldRef:
                fieldPath: spec.nodeName
        volumeMounts:
        - name: vol001
          mountPath: /tmp
        command: ["/bin/sh -c 'mkdir /tmp && touch /tmp/date.log'"]

From describe I am getting error as below

Warning  Failed     14s (x3 over 32s)  kubelet            

Error: failed to create containerd task: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: 
exec: "/bin/sh -c 'mkdir /tmp && touch /tmp/date.log'": stat /bin/sh -c 'mkdir /tmp && touch /tmp/date.log': no such file or directory: unknown

Any suggestions, much appreciated.

Thank you.

CodePudding user response:

You need to format your command to separate the arguments properly, right now your entire shell command is being perceived as a "file that is a shell script" to be executed with "sh -c". And since there is no file named mkdir /tmp && touch /tmp/date.log the shell returns an error.

You can fix this as follows:

command: ["/bin/sh", "-c", "mkdir /tmp && touch /tmp/date.log"]

CodePudding user response:

You need to pass bin/sh & -c as separate values in the command list like this:

command: ["/bin/sh", "-c", "mkdir /tmp && touch /tmp/date.log"]
  • Related