Skip to content

Instantly share code, notes, and snippets.

@luhonghai
Created June 13, 2018 07:22
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save luhonghai/38e00c29f5c4e7c2862eb0b296a8206d to your computer and use it in GitHub Desktop.
Save luhonghai/38e00c29f5c4e7c2862eb0b296a8206d to your computer and use it in GitHub Desktop.
Kubectl exec pod by label
kubectl exec --namespace=manadr-dev -it $(kubectl get pod -l "service=mysql" --namespace=manadr-dev -o jsonpath='{.items[0].metadata.name}') -- bash
@piedai
Copy link

piedai commented Nov 4, 2021

Thank you it works perfectly!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment