A
Aura Dev

Kubernetes Cheatsheet

kubectl commands and resources.

Basic Commands

Cluster Info

kubectl cluster-info
kubectl get nodes
kubectl top nodes
kubectl top pods

Context & Config

kubectl config view
kubectl config get-contexts
kubectl config use-context <name>
kubectl config set-context --current --namespace=<ns>

Working with Pods

Get & Describe

kubectl get pods
kubectl get pods -A              # All namespaces
kubectl get pods -o wide         # More details
kubectl describe pod <name>

Logs & Exec

kubectl logs <pod-name>
kubectl logs -f <pod-name>       # Follow logs
kubectl exec -it <pod> -- sh     # Shell into pod

Deployments & Services

Deployments

kubectl get deployments
kubectl scale deploy <name> --replicas=3
kubectl rollout status deploy <name>
kubectl rollout restart deploy <name>
kubectl rollout undo deploy <name>

Services

kubectl get svc
kubectl describe svc <name>
kubectl port-forward svc/<name> 8080:80

Applying & Deleting

Apply Resources

kubectl apply -f ./file.yaml
kubectl apply -f ./dir/
kubectl create -f ./file.yaml

Delete Resources

kubectl delete -f ./file.yaml
kubectl delete pod <name>
kubectl delete all -l app=my-app

What is Kubernetes?

Kubernetes (K8s) is an open-source system for automating the deployment, scaling, and management of containerized applications.

This cheatsheet covers essential `kubectl` commands for managing pods, deployments, services, and cluster resources.

Sponsored LinkAdvertisement Space (728x90)