Reputation: 1114
I am trying to run command that needs to use environment variables specific to the container ($JAVA_HOME), but it seems that variable is expanded on my local shell before sending command to the pod container
kubectl exec my-pod "echo ${JAVA_HOME}"
produces:
Use 'kubectl describe pod/my-pod -n default' to see all of the containers in this pod.
OCI runtime exec failed: exec failed: container_linux.go:345: starting container process caused "exec: \"echo \": executable file not found in $PATH": unknown
command terminated with exit code 126
I tried several syntax without luck (e.g. bash -c). How to escape the variable so that it is evaluated on the target container?
Upvotes: 1
Views: 1994