<p>I am able to login to the container running in a pod using <code>kubectl exec -t ${POD } /bin/bash --all-namespaces</code>
(POD is the text parameter value in my Jenkins job, In which user would have entered the pod name before running the job), Now my question is : I am able to login into the container , I want to my test.sh file from the logged in container ?
Flow: </p>

<p>Step1 : Run a Jenkins job which should login to a docker container running inside the pods</p>

<p>Step: From the container execute the test.sh script.</p>

<p>test.sh</p>

<p>echo "This is demo file"</p>

<p>There is no need to have two steps one step is sufficient. I believe below should get the job done</p>

<p>kubectl exec ${POD} /path/to/script/test.sh --all-namespaces</p>

<p>Below is the reference form Kubernetes <a href="https://kubernetes.io/docs/reference/kubectl/cheatsheet/" rel="nofollow noreferrer">documentation</a></p>

<blockquote>
  <p>kubectl exec my-pod -- ls /                         # Run command in
  existing pod (1 container case)</p>
  
  <p>kubectl exec my-pod -c my-container -- ls /         # Run command in
  existing pod (multi-container case)</p>
</blockquote>
