Created
March 7, 2024 01:15
-
-
Save guilhermeteodoro/2b8a035f60096a0f6e0bab53356a1277 to your computer and use it in GitHub Desktop.
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 | |
# Go to disposable container on a given namespace | |
# Usage: disposable <namespace> | |
# Example: | |
# $ disposable production-edupass | |
disposable() { | |
local namespace="$1" | |
if [ -z "$namespace" ]; then | |
return | |
fi | |
local container_name=$( | |
kubectl get pods --no-headers -n $namespace -o custom-columns=":metadata.name" | grep disposable | grep -v update | |
) | |
echo "\n\t> Running \`kubectl exec -it $container_name -n $namespace -- sh\`\n" | |
kubectl exec -it $container_name -n $namespace -- sh | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment