cool_stuff_coming
cool_stuff_coming

Reputation: 453

runc create failed: unable to start container process: exec: \"/scripts/scr.sh\": permission denied"

I am learning to execute scripts in kubernetes. i am using below yaml , however, it keeps failing and pod status is CreateContainerError. Can you suggest how to get around this.

apiVersion: v1
kind: ConfigMap
metadata:
  name: custom-script
data:
  scr.sh: |
    #!/bin/bash
    echo "Successfull."

    sleep infinity
---
apiVersion: batch/v1
kind: Job
metadata:
  name: custom-scr-job
spec:
  template:
    spec:
      volumes:
        - name: scripts
          configMap: 
            name: custom-script
            defaltMode: 0777

      containers:
      - name: custom-scr-c
        image: ubuntu
        command: ["/scripts/scr.sh"]
        volumeMounts:
          - name: scripts
            mountPath: /scripts

      restartPolicy: Never

Pod logs show below message:

Normal Pulled 38s kubelet
Successfully pulled image "ubuntu" in 120.425438ms (120.434536ms including waiting)

Warning Failed 38s kubelet Error: container create failed: time="2023-04-20T19:41:59Z" level=error msg="runc create failed: unable to start container process: exec: "/scripts/scr.sh": permission denied"

Upvotes: 0

Views: 735

Answers (1)

cool_stuff_coming
cool_stuff_coming

Reputation: 453

Used /bin/bash with different image and worked fine.

Upvotes: 0

Related Questions