Kubernetes commands at a glance: kubectl cheat sheet

Your handy guide of commonly used kubectl commands to display one or many resources when running commands against clusters. Click to copy to clipboard easily, or download the PDF cheatsheet as a useful reference.

Deployments

kubectl get deploy -o wide
kubectl get deploy -o yaml
kubectl get deploy --show-labels
kubectl get deploy -l [label_name]

DaemonSets

kubectl get no --show-labels
kubectl get no -l [label_name]

Services

kubectl get svc --show-labels
kubectl get svc -l [label_name]

RBAC

kubectl get serviceaccount
kubectl get serviceaccount -o yaml
kubectl get rolebindings -o yaml
kubectl get clusterroles -o yaml
kubectl get clusterrolebindings
kubectl get clusterrolebindings -o yaml
kubectl get customresource
kubectl get customresource -o yaml
kubectl get customresourcedefinition
kubectl get customresourcedefinition -o y
kubectl auth reconcile -f my-rbac-rules.yaml

Secrets

kubectl get secrets -o yaml

StorageClass

PersistentVolume

PersistentVolumeClaim

Ingress

kubectl get ingress -o yaml

Applying and Updating Resources

kubectl apply -f [resource.yaml]
kubectl delete -f [resource.yaml]

Download the PDF version of this kubectl cheat sheet

CAEPE Continuous Deployment

Manage workloads on Kubernetes anywhere robustly and securely.

  • Shores up security by simplifying deployment anywhere, supporting managed services, native Kubernetes, self-hosted, edge and secure airgapped deployment targets. 
  • Supports GitOps and provides guided, UI-driven workflows for all major progressive delivery strategies
  • Has RBAC built-in, providing inherent enterprise access control for who can deploy.
  • Supports extended testing capabilities enabling your team to run different tests quickly and easily.

Check out these other resources:

Scroll to Top