Created
June 28, 2019 15:19
-
-
Save viniciusjssouza/42666e6d01b28ce2deaf1bf426d36929 to your computer and use it in GitHub Desktop.
run a command inside a running POD
This file contains hidden or 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 | |
| # run a shell inside a running POD | |
| # Paramenter 1: the name of the "app". The deployment should match <app_name>-deployment and the container must have the | |
| # app name. | |
| POD_NAME=$(kubectl get pods -n stock --no-headers -o custom-columns=":metadata.name" | grep -m1 "$1-deployment") | |
| echo "Acessing pod $POD_NAME" | |
| kubectl exec -it "$POD_NAME" -n stock -c "$1" -- sh |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment