<p>I have a Helm Chart for Cassandra, which is running fine, I am able to connect to it and run <code>cqlsh</code> commands.<br />
I want to add a Helm Hook to the chart. I've managed how to do it, however, I cannot execute cqlsh in the container. This is my Kubernetes Job I want to execute in <code>post-install</code> phase.</p>
<pre><code>apiVersion: batch/v1
kind: Job
metadata:
  name: my-job
spec:
  template:
    metadata:
     name: hook-job
     annotations:
       &quot;helm.sh/hook&quot;: post-install
       &quot;helm.sh/hook-delete-policy&quot;: hook-succeeded
   spec:
     containers:
     - name: cqlsh-cmd
       image: &lt;cassandra-image&gt;
       command: [&quot;bin/sh&quot;, &quot;-c&quot;, &quot;cqlsh&quot;]
     restartPolicy: OnFailure
 
</code></pre>
<p>However, the cqlsh command is not found.</p>
<p>In general it seems odd I have to re-use the same container I have defined in Helm Chart. Am I doing something wrong?</p>

<p>your pod/container may not up at that time. Use it under post life cycle.</p>
<pre><code>  spec:
    containers:
    - name: cqlsh-cmd
      image: &lt;cassandra-image&gt;
      lifecycle:
        postStart:
          exec:
            command: [&quot;/bin/sh&quot;, &quot;-c&quot;, &quot;
                set -x\n
                while true;\n
                do\n
                  echo 'looking cassandra...,'\n
                  timeout 1 bash -c 'cat &lt; /dev/null &gt; /dev/tcp/localhost/9042'\n
                  exitCode=$?\n

                  if [ $exitCode = 0 ]; then\n
                    cqlsh /** your command **/ \n
                    break;\n
                  fi\n
                  sleep 1s\n
                done\n
              &quot;]
</code></pre>
