Created
April 18, 2020 17:13
-
-
Save russianryebread/7c86e11e2d7401fc8f233bc9a3aeb8e9 to your computer and use it in GitHub Desktop.
Quick way to exec into a pod in K8s
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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