How do you remove a kubernetes context?

4/27/2016

I was following a tutorial on kubernetes and it told me to run the following commands:

kubectl config set-cluster --server=http://127.0.0.1:8080
kubectl config set-context local --cluster=local
kubectl config use-context local

Now when I run kubectl config view I see an entry for local:

contexts:
- context:
    cluster: local
    user: ""
  name: local

I was kind of curious about this so I ran the following command:

kubectl config set-context testorz --cluster=local

Now I see that when I run kubectl config view

How do I remove my "testorz" context?

-- Dismissile
kubernetes

1 Answer

4/27/2016

You can kubectl config unset contexts.testorz to remove that entry.

See http://kubernetes.io/docs/user-guide/kubectl/kubectl_config_unset/

-- CJ Cullen
Source: StackOverflow