Skip to content

Instantly share code, notes, and snippets.

@serafo27
Last active February 7, 2022 15:00
Show Gist options
  • Save serafo27/d6655436eb56fa2b6610e5fe7738ee59 to your computer and use it in GitHub Desktop.
Save serafo27/d6655436eb56fa2b6610e5fe7738ee59 to your computer and use it in GitHub Desktop.
K8s Cheatsheet

K8s Cheatsheet

Get all the contexts:

kubectl config get-contexts

Get current context:

kubectl config current-context

Select context

kubectl config use-context my-cluster-name

Get all the namespaces

kubectl get namespace

Get pods of a namespace

kubectl get pods --namespace=any_namespace

Get pods of a namespace in watch mode

kubectl get pods --namespace=any_namespace --watch

Get verbose pods of a namespace

kubectl get pods --namespace=any_namespace -o wide

Get yaml config file of a single pod

kubectl get pods --namespace=any_namespace pod_name -o yaml

Get quota numbers

kubectl describe quota --namespace=any_namespace

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment