Kubectl How to List All 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...
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"
3 Answers
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.