Skip to content

Commit d741023

Browse files
committed
Add a note on how to delete kubectl config user name
1 parent 5115d4f commit d741023

2 files changed

Lines changed: 10 additions & 3 deletions

File tree

content/en/docs/reference/kubectl/cheatsheet.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,18 +58,21 @@ kubectl config view # Show Merged kubeconfig settings.
5858
# use multiple kubeconfig files at the same time and view merged config
5959
KUBECONFIG=~/.kube/config:~/.kube/kubconfig2 kubectl config view
6060

61-
# Get the password for the e2e user
61+
# get the password for the e2e user
6262
kubectl config view -o jsonpath='{.users[?(@.name == "e2e")].user.password}'
6363

64-
kubectl config current-context # Display the current-context
65-
kubectl config use-context my-cluster-name # set the default context to my-cluster-name
64+
kubectl config view -o jsonpath='{.users[].name}' # get a list of users
65+
kubectl config current-context # display the current-context
66+
kubectl config use-context my-cluster-name # set the default context to my-cluster-name
6667

6768
# add a new cluster to your kubeconf that supports basic auth
6869
kubectl config set-credentials kubeuser/foo.kubernetes.com --username=kubeuser --password=kubepassword
6970

7071
# set a context utilizing a specific username and namespace.
7172
kubectl config set-context gce --user=cluster-admin --namespace=foo \
7273
&& kubectl config use-context gce
74+
75+
kubectl config unset users.foo # delete user foo
7376
```
7477

7578
## Creating Objects

content/en/docs/tasks/access-application-cluster/configure-access-multiple-clusters.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,10 @@ kubectl config --kubeconfig=config-demo set-credentials developer --client-certi
8585
kubectl config --kubeconfig=config-demo set-credentials experimenter --username=exp --password=some-password
8686
```
8787

88+
{{< note >}}
89+
To delete a user you can run `kubectl config unset users.<name>`
90+
{{< /note >}}
91+
8892
Add context details to your configuration file:
8993

9094
```shell

0 commit comments

Comments
 (0)