Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@russianryebread
Created April 18, 2020 17:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save russianryebread/7c86e11e2d7401fc8f233bc9a3aeb8e9 to your computer and use it in GitHub Desktop.
Save russianryebread/7c86e11e2d7401fc8f233bc9a3aeb8e9 to your computer and use it in GitHub Desktop.
Quick way to exec into a pod in K8s
#!/bin/bash
# Usage:
# ./exec.sh api
NAMESPACE="qa"
CONTAINER_NAME=$(kubectl get pods -n $NAMESPACE | awk -v pattern="$1" '$0 ~ pattern { print $1 }')
kubectl -n $NAMESPACE exec -it $CONTAINER_NAME /bin/bash
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment