Skip to content

Instantly share code, notes, and snippets.

@half2me
Created September 12, 2019 09:56
Show Gist options
  • Save half2me/ef8e7f41126e93c0c505f13d14426912 to your computer and use it in GitHub Desktop.
Save half2me/ef8e7f41126e93c0c505f13d14426912 to your computer and use it in GitHub Desktop.
run a command on kubernetes pod by deployment name
k8exec() {
local pod=$1
shift
kubectl exec -it $(kubectl get pods -o name | grep -m1 $pod | cut -d'/' -f 2) -- $@
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment