<p>I have a shell script that has several kubectl commands, I need to execute it as a part of helm installation.</p>

<p><code>#!/bin/bash
kubectl create secret generic mysecret --from-literal=username=$USER_NAME --from-literal=password=$passwrd</code></p>

<p>I have written a job which execute this script.</p>

<pre><code>apiVersion: batch/v1
kind: Job
metadata:
  name: "sagdfghd"

spec:
  template:        
    spec:
      containers:
        - name: sagdfghd
          image: {{ .Values.jobs.dockerRegistry }}
          command: ["sh", "-c", {{ .Files.Get "scripts/myscript.sh" | quote }} ]
</code></pre>

<p>But as the script is running inside container it is not able to find kubectl command.</p>

<p>Any idea how can I run this script??</p>

<p>TIA</p>

Sudhir Pandey
<p>What image does <code>{{ .Values.jobs.dockerRegistry }}</code> resolve to and does it have the <code>kubectl</code> tool installed on it? It most likely does not have kubectl installed on it, so you will have to add the kubectl install instructions in your Dockerfile. Those instructions will depend on what your base Docker image is. See the following link:</p>

<p><a href="https://kubernetes.io/docs/tasks/tools/install-kubectl/#install-kubectl" rel="nofollow noreferrer">https://kubernetes.io/docs/tasks/tools/install-kubectl/#install-kubectl</a></p>
