Use kubectl config current-context to simplify the instructions

This commit is contained in:
Everett Toews
2017-03-09 09:59:38 -06:00
committed by Andrew Chen
parent 447049890d
commit 17daa9837f
+1 -9
View File
@@ -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 You can permanently save the namespace for all subsequent kubectl commands in that
context. context.
First get your current context:
```shell ```shell
$ export CONTEXT=$(kubectl config view | awk '/current-context/ {print $2}') $ kubectl config set-context $(kubectl config current-context) --namespace=<insert-namespace-name-here>
```
Then update the default namespace:
```shell
$ kubectl config set-context $CONTEXT --namespace=<insert-namespace-name-here>
# Validate it # Validate it
$ kubectl config view | grep namespace: $ kubectl config view | grep namespace:
``` ```