<p>I am trying to run an external <em>bash</em> script using the below <code>yaml</code> file.</p>
<p>The script is inside the <code>/scripts/run.sh</code> folder. I have also given the <code>defaultMode: 0777</code></p>
<p>This is the error I get.</p>
<pre><code>sh: 0: Can't open /scripts/run.sh
</code></pre>
<pre><code>apiVersion: v1
data:
  script.sh: |-
    echo &quot;Hello world!&quot;
    kubectl get pods
kind: ConfigMap
metadata:
  name: script-configmap
---
apiVersion: batch/v1
kind: Job
metadata:
  labels:
    app: script-job
  name: script-job
spec:
  backoffLimit: 2
  template:
    spec:
      containers:
        - command:
            - sh
            - /scripts/run.sh
          image: 'bitnami/kubectl:1.12'
          name: script
          volumeMounts:
            - name: script-configmap
              mountPath: /scripts
              subPath: run.sh              
              readOnly: false
      restartPolicy: Never
      volumes:
        - name: script-configmap
          configMap:
            name: script-configmap
            defaultMode: 0777
</code></pre>

jeril
<p>The file name is <code>script.sh</code> and not <code>run.sh</code></p>
<p>Try</p>
<pre><code>containers:
    - command:
        - sh
        - /scripts/script.sh
</code></pre>
