How do I view all the contexts I have set up with kubectl?
It doesn't appear there's a resource known to kubectl as 'contexts'
$ kubectl get contexts
error: the server doesn't have a resource type "contexts"
How do I view all the contexts I have set up with kubectl?
It doesn't appear there's a resource known to kubectl as 'contexts'
$ kubectl get contexts
error: the server doesn't have a resource type "contexts"
You can view all contexts via the config command
$ kubectl config get-contexts
For the kubectl
command, use this command to list all the contexts:
kubectl config get-contexts
You can view the default config file that locates at ~/.kube/config
, it contains more info like clusters
, users
, ...
In addition to you answer, you can use kubectx tool to easily switch between clusters and namespaces.