All cheat sheets

Kubernetes reference

Kubernetes Commands Cheat Sheet

Quick kubectl and Helm references for pods, deployments, services, configuration, storage, debugging, networking, and RBAC.

View source repository
45 command references12 topic sections

12 of 12 sections

Basic Commands

CommandDescription
kubectl version --clientCheck Kubernetes version
kubectl cluster-infoGet cluster information
kubectl get nodesList all nodes
kubectl describe node <node-name>Get detailed node information
kubectl get componentstatusesView system component statuses

Pods

CommandDescription
kubectl get podsList all pods
kubectl describe pod <pod-name>Get pod details
kubectl apply -f pod.yamlCreate a pod from YAML
kubectl delete pod <pod-name>Delete a pod
kubectl exec -it <pod-name> -- /bin/shExecute a command inside a pod

Deployments

CommandDescription
kubectl get deploymentsList all deployments
kubectl describe deployment <deployment-name>Describe a deployment
kubectl scale deployment <deployment-name> --replicas=3Scale a deployment
kubectl rollout undo deployment <deployment-name>Rollback a deployment

Services

CommandDescription
kubectl get servicesList all services
kubectl describe service <service-name>Describe a service
kubectl expose deployment <deployment-name> --type=LoadBalancer --port=80Expose a deployment as a service

ConfigMaps & Secrets

CommandDescription
kubectl create configmap <name> --from-literal=key=valueCreate a ConfigMap
kubectl get configmapsList all ConfigMaps
kubectl create secret generic <name> --from-literal=password=secretCreate a Secret
kubectl get secretsList all Secrets

Namespaces

CommandDescription
kubectl get namespacesList all namespaces
kubectl create namespace <namespace-name>Create a new namespace
kubectl delete namespace <namespace-name>Delete a namespace

Volumes & Persistent Volumes

CommandDescription
kubectl get pvList persistent volumes
kubectl get pvcList persistent volume claims
kubectl describe pv <pv-name>Describe a persistent volume

Logging & Debugging

CommandDescription
kubectl logs <pod-name>View logs of a pod
kubectl logs <pod-name> -c <container-name>View logs of a container within a pod
kubectl describe pod <pod-name>Debug a failing pod

Helm

CommandDescription
helm install <release-name> <chart-name>Install Helm chart
helm listList installed Helm releases
helm uninstall <release-name>Uninstall a Helm release

Networking

CommandDescription
kubectl get servicesList all services
kubectl get ingressList all ingress resources
kubectl describe ingress <ingress-name>Describe an ingress resource
kubectl get networkpolicyList all network policies

RBAC (Role-Based Access Control)

CommandDescription
kubectl get rolesList all roles
kubectl get rolebindingsList all role bindings
kubectl get clusterrolesList all cluster roles
kubectl get clusterrolebindingsList all cluster role bindings
kubectl describe role <role-name>Describe a specific role

Miscellaneous

CommandDescription
kubectl apply -f <file.yaml>Apply configuration from a YAML file
kubectl delete -f <file.yaml>Delete resources using a YAML file
kubectl api-resourcesGet API resources