Helm chart copy shell script from local machine to remote pod , change permission and exeucte

10/26/2019

Is there a way I can copy shell script from local machine to pod using charts and helm, change the script permission and execute the script inside the pod?

-- drifter
kubernetes-helm

1 Answer

10/26/2019

No, Helm cannot do this. In effect only the Kubernetes commands it can run are kubectl apply and kubectl delete, though it can apply templating before sending YAML off to the Kubernetes server. The sorts of imperative commands you're describing (kubectl cp and kubectl exec) aren't things Helm can do.

(The sorts of imperative commands you're describing aren't generally good form in Kubernetes in any case. Generally you'd need to package your script up in a Docker image to be able to run it in the cluster, and you want to try to set up your containers to be able to set themselves up as much as they can. Also remember that pods get deleted routinely, sometimes even outside of your control, and anything you've manually copied into a pod will get lost when this happens.)

-- David Maze
Source: StackOverflow