Exec command in all pods

Run a command in every pod matching a label selector

kubectl get pods -n <ns> -l app=<label> -o name | xargs -I{} kubectl exec {} -n <ns> -- <cmd>

tool
kubectl73 commands
tags
podsdebug

More kubectl commands

all 73 kubectl commands