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
| # Store these in your .bashrc or .zshrc | |
| # Change kubectl namespace in current context | |
| kns() { | |
| if [ -z "$1" ]; then | |
| echo "Current namespace: $(kubectl config view --minify --output 'jsonpath={..namespace}' 2>/dev/null || echo 'default')" | |
| echo "Usage: kns <namespace>" | |
| echo "Available namespaces:" | |
| kubectl get namespaces --output=name | sed 's/namespace\///' | |
| return 1 |