Add a note on how to delete kubectl config user name (#13257)

This commit is contained in:
Dani Comnea 2019-03-19 18:12:23 +00:00 committed by Kubernetes Prow Robot
parent b1634fcc1c
commit ad77c02575
2 changed files with 10 additions and 3 deletions

View File

@ -58,11 +58,12 @@ kubectl config view # Show Merged kubeconfig settings.
# use multiple kubeconfig files at the same time and view merged config # use multiple kubeconfig files at the same time and view merged config
KUBECONFIG=~/.kube/config:~/.kube/kubconfig2 kubectl config view KUBECONFIG=~/.kube/config:~/.kube/kubconfig2 kubectl config view
# Get the password for the e2e user # get the password for the e2e user
kubectl config view -o jsonpath='{.users[?(@.name == "e2e")].user.password}' kubectl config view -o jsonpath='{.users[?(@.name == "e2e")].user.password}'
kubectl config current-context # Display the current-context kubectl config view -o jsonpath='{.users[].name}' # get a list of users
kubectl config use-context my-cluster-name # set the default context to my-cluster-name kubectl config current-context # display the current-context
kubectl config use-context my-cluster-name # set the default context to my-cluster-name
# add a new cluster to your kubeconf that supports basic auth # add a new cluster to your kubeconf that supports basic auth
kubectl config set-credentials kubeuser/foo.kubernetes.com --username=kubeuser --password=kubepassword kubectl config set-credentials kubeuser/foo.kubernetes.com --username=kubeuser --password=kubepassword
@ -70,6 +71,8 @@ kubectl config set-credentials kubeuser/foo.kubernetes.com --username=kubeuser -
# set a context utilizing a specific username and namespace. # set a context utilizing a specific username and namespace.
kubectl config set-context gce --user=cluster-admin --namespace=foo \ kubectl config set-context gce --user=cluster-admin --namespace=foo \
&& kubectl config use-context gce && kubectl config use-context gce
kubectl config unset users.foo # delete user foo
``` ```
## Creating Objects ## Creating Objects

View File

@ -85,6 +85,10 @@ kubectl config --kubeconfig=config-demo set-credentials developer --client-certi
kubectl config --kubeconfig=config-demo set-credentials experimenter --username=exp --password=some-password kubectl config --kubeconfig=config-demo set-credentials experimenter --username=exp --password=some-password
``` ```
{{< note >}}
To delete a user you can run `kubectl config unset users.<name>`
{{< /note >}}
Add context details to your configuration file: Add context details to your configuration file:
```shell ```shell