Switching contexts

When using kubectl, a context is a grouping of clusters, user credentials, and namespaces. kubectl uses information stored in these contexts to communicate with any cluster.

When we set up our local cluster using Minikube, it creates a default minikube context for us. We can confirm this by running kubectl config current-context:

$ kubectl config current-contextminikube

kubectl gets its configuration from the file specified by the KUBECONFIG environment variable. This was set in our .profile file to $HOME/.kube/config. If we look inside it, we will see that it is very similar to the config we downloaded from DigitalOcean:

apiVersion: v1clusters:- cluster:    certificate-authority: ~/.minikube/ca.crt server: ...

Get Building Enterprise JavaScript Applications now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.