Run a Bash command within a Kubernetes pod

Runs a Bash command in a Kubernetes pod. The double dash symbol "--" is used to separate the command you want to run inside the container from the kubectl arguments.

Authored by: nicola-ben
pod_name
bash_command

Command
Copy
kubectl exec -it --namespace=tools pod_name -- bash -c "bash_command"
Tags