Skip to content

Instantly share code, notes, and snippets.

@guilhermeteodoro
Created March 7, 2024 01:15
Show Gist options
  • Save guilhermeteodoro/2b8a035f60096a0f6e0bab53356a1277 to your computer and use it in GitHub Desktop.
Save guilhermeteodoro/2b8a035f60096a0f6e0bab53356a1277 to your computer and use it in GitHub Desktop.
#!/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