From ad77c02575afd759fa59e8fd809ccd9141aaba44 Mon Sep 17 00:00:00 2001 From: Dani Comnea Date: Tue, 19 Mar 2019 18:12:23 +0000 Subject: [PATCH] Add a note on how to delete kubectl config user name (#13257) --- content/en/docs/reference/kubectl/cheatsheet.md | 9 ++++++--- .../configure-access-multiple-clusters.md | 4 ++++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/content/en/docs/reference/kubectl/cheatsheet.md b/content/en/docs/reference/kubectl/cheatsheet.md index 47c9a505e5..47f9c3017d 100644 --- a/content/en/docs/reference/kubectl/cheatsheet.md +++ b/content/en/docs/reference/kubectl/cheatsheet.md @@ -58,11 +58,12 @@ 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 @@ -70,6 +71,8 @@ kubectl config set-credentials kubeuser/foo.kubernetes.com --username=kubeuser - # 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 diff --git a/content/en/docs/tasks/access-application-cluster/configure-access-multiple-clusters.md b/content/en/docs/tasks/access-application-cluster/configure-access-multiple-clusters.md index 55d5c6873d..8ab3e1007a 100644 --- a/content/en/docs/tasks/access-application-cluster/configure-access-multiple-clusters.md +++ b/content/en/docs/tasks/access-application-cluster/configure-access-multiple-clusters.md @@ -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.` +{{< /note >}} + Add context details to your configuration file: ```shell