kubectl 1.37 cheatsheet

kubectl 1.37: Clusters and contexts

6 common kubectl 1.37 tasks.

Check the client version

Print the kubectl client version.

kubectl version --client

Check the cluster

Show the addresses of the control plane and core services.

kubectl cluster-info

List contexts

Show the clusters and users in your kubeconfig. The current one is starred.

kubectl config get-contexts

Show the current context

Print which cluster kubectl is talking to.

kubectl config current-context

Switch cluster

Make another context the default.

kubectl config use-context my-cluster

Set the default namespace

Use a namespace for the current context so you can skip -n.

kubectl config set-context --current --namespace=dev

Was this page helpful?