$ kubectl ns
Current default namespace is "koji".
$ kubectl ns koji
Context "minikube" modified.
Default namespace switched to "koji".
#!/bin/bash | |
if [[ "$1" == "" ]]; then | |
NS=$(kubectl config view --minify --output 'jsonpath={..namespace}') | |
echo "Current default namespace is \"$NS\"." | |
exit 0; | |
fi | |
kubectl config set-context --current --namespace=$1 | |
echo "Default namespace switched to \"$1\". |