Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save marcelbirkner/6d86db6765b406e3e716c10d5b7b9547 to your computer and use it in GitHub Desktop.
Save marcelbirkner/6d86db6765b406e3e716c10d5b7b9547 to your computer and use it in GitHub Desktop.
Execute command on all running Kubernetes pods
#!/bin/bash
for POD in $(kubectl get pods --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}')
do
kubectl exec -it ${POD} -- ps aux
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment