Use kubectl config current-context to simplify the instructions
This commit is contained in:
committed by
Andrew Chen
parent
447049890d
commit
17daa9837f
@@ -64,16 +64,8 @@ $ kubectl --namespace=<insert-namespace-name-here> get pods
|
||||
You can permanently save the namespace for all subsequent kubectl commands in that
|
||||
context.
|
||||
|
||||
First get your current context:
|
||||
|
||||
```shell
|
||||
$ export CONTEXT=$(kubectl config view | awk '/current-context/ {print $2}')
|
||||
```
|
||||
|
||||
Then update the default namespace:
|
||||
|
||||
```shell
|
||||
$ kubectl config set-context $CONTEXT --namespace=<insert-namespace-name-here>
|
||||
$ kubectl config set-context $(kubectl config current-context) --namespace=<insert-namespace-name-here>
|
||||
# Validate it
|
||||
$ kubectl config view | grep namespace:
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user