🚀 Top 20 Most Useful kubectl Commands for Everyday Kubernetes Workflows
Whether you're a developer, SRE, DevOps engineer, or just starting out with Kubernetes, mastering kubectl is essential. Here’s a curated list of the top 20 kubectl commands that are universally useful across teams and cloud platforms (EKS, GKE, AKS, etc.). These commands will save you time, reduce confusion, and help you debug faster.
🔟 Most Commonly Used kubectl Commands
1. Get all pods across namespaces
kubectl get pods -AGreat for seeing what’s running cluster-wide and spotting stuck or crashing pods.
2. Describe a pod (deep debugging)
kubectl describe pod -nReveals node assignment, events, taints, failed mounts, and more.
3. View logs from a pod
kubectl logs -nUse --previous if the pod has crashed and restarted.
4. Exec into a running container
kubectl exec -it -n -- /bin/shGreat for real-time inspection, testing configs, or quick troubleshooting.
5. View recent events (cluster-wide)
kubectl get events -A --sort-by='.lastTimestamp'Use this to see the latest cluster activity, scheduling failures, crashes, and warnings.
6. View resource usage per pod
kubectl top pods -ARequires Metrics Server installed. Useful for performance monitoring.
7. Get all services across namespaces
kubectl get svc -AQuickly see which services are exposed and their types (ClusterIP, LoadBalancer, etc).
8. Restart a deployment
kubectl rollout restart deployment -nTriggers a rolling restart—useful after changing ConfigMaps, Secrets, or images.
9. Port forward to a service or pod
kubectl port-forward svc/ 8080:80 -nPerfect for accessing internal services locally.
10. Get everything in a namespace
kubectl get all -nOne-liner to view pods, deployments, services, etc., all at once.
🔟 More Essential kubectl Commands
11. Check node info
kubectl get nodes -o wideDisplays node capacity, labels, roles, and IPs.
12. List namespaces with labels
kubectl get namespaces --show-labelsHelps with namespace-level Fargate profiles and label selectors.
13. Get custom resources (CRDs)
kubectl get crdsEssential when working with operators, controllers, or observability tooling.
14. Copy files into/from a pod
kubectl cp ./local-file.txt :/tmp/ -nUse this for backups, config injection, or pulling logs/artifacts out.
15. Apply a manifest
kubectl apply -f your-file.yamlDeclarative way to manage resources.
16. Delete a resource
kubectl delete deployment -nUseful for clearing broken resources blocking Terraform or Helm.
17. Watch pod status live
kubectl get pods -n -wGreat for seeing rollout or crash cycles in real time.
18. Label a resource
kubectl label pod env=staging -nLabels are powerful for selectors, policies, and organizing workloads.
19. Taint a node
kubectl taint nodes key=value:NoScheduleAdvanced scheduling control—combine with pod tolerations.
20. Explain a Kubernetes resource
kubectl explain deployment.spec.template.spec.containersLearn the structure of complex manifests right from the CLI.
✅ Wrap-up
Mastering these 20 kubectl commands will level up your day-to-day efficiency in any Kubernetes environment—especially when using infrastructure as code with Terraform or Helm. Keep this cheat sheet close, and you'll debug faster and deploy smarter.
Feel free to bookmark or share! 🚀