codegurukool.com · Free coding tutorials & online compiler

Home › Kubernetes Tutorial › kubectl and contexts

kubectl and contexts

Tell kubectl which cluster to use.

kubectl reads a kubeconfig file (usually ~/.kube/config) that lists clusters, users and contexts. A context is a cluster plus a user plus a default namespace. The star marks the context in use. Switch with kubectl config use-context NAME.

Example code

kubectl config get-contexts

Run this code in the online editor

← Kubernetes architecturePods and YAML manifests →