Skip to content

Commit

Permalink
Add a note on how to delete kubectl config user name (#13257)
Browse files Browse the repository at this point in the history
  • Loading branch information
DanyC97 authored and k8s-ci-robot committed Mar 19, 2019
1 parent b1634fc commit ad77c02
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
9 changes: 6 additions & 3 deletions content/en/docs/reference/kubectl/cheatsheet.md
Expand Up @@ -58,18 +58,21 @@ kubectl config view # Show Merged kubeconfig settings.
# use multiple kubeconfig files at the same time and view merged config
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 current-context # Display the current-context
kubectl config use-context my-cluster-name # set the default context to my-cluster-name
kubectl config view -o jsonpath='{.users[].name}' # get a list of users
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
kubectl config set-credentials kubeuser/foo.kubernetes.com --username=kubeuser --password=kubepassword

# set a context utilizing a specific username and namespace.
kubectl config set-context gce --user=cluster-admin --namespace=foo \
&& kubectl config use-context gce

kubectl config unset users.foo # delete user foo
```

## Creating Objects
Expand Down
Expand Up @@ -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
```

{{< note >}}
To delete a user you can run `kubectl config unset users.<name>`
{{< /note >}}

Add context details to your configuration file:

```shell
Expand Down

0 comments on commit ad77c02

Please sign in to comment.