Alias for context

This commit is contained in:
mtilson 2022-01-09 12:47:43 +03:00 committed by GitHub
parent 9c8367804c
commit 1e85065aaa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions

View File

@ -74,8 +74,9 @@ kubectl config set-context gce --user=cluster-admin --namespace=foo \
kubectl config unset users.foo # delete user foo
# short alias to set/show namespace (useful for CKAD/CKA exams)
alias kn='f() { [ "$1" ] && kubectl config set-context --current --namespace $1 || kubectl config view --minify | grep namespace ; } ; f'
# short alias to set/show context/namespace (useful for CKAD/CKA exams)
alias kn='f() { [ "$1" ] && kubectl config set-context --current --namespace $1 || kubectl config view --minify | grep namespace | cut -d" " -f6 ; } ; f'
alias kx='f() { [ "$1" ] && kubectl config use-context $1 || kubectl config current-context ; } ; f'
```
## Kubectl apply