10 Kubernetes Commands Every DevOps Engineer Uses Daily
Master the 10 most essential kubectl commands that real DevOps and platform engineers run every single day in 2025. Includes practical examples, aliases, and pro tips for debugging, scaling, logs, and cluster operations.
Introduction
Kubernetes is powerful, but you don’t need to memorize 300+ kubectl commands to be effective. In real production environments in 2025, 95% of daily work is done with just 10 core commands (plus a few aliases). Whether you’re debugging a crashing pod, checking resource usage, or helping a developer access a service, these are the exact commands elite teams use hundreds of times per day.
Most clusters run securely inside a well-segmented Virtual Private Cloud (VPC) with private API endpoints.
1. kubectl get – Your Daily Dashboard
The single most used command. Always start here.
kubectl get pods -A→ see every pod in the clusterkubectl get pods -n production→ specific namespacekubectl get nodes→ check worker node statuskubectl get svc,ing,deploy→ quick overview
Pro tip: alias k → kubectl and use kgp for kubectl get pods
2. kubectl describe – When You Need the Full Story
kubectl describe shows events, conditions, and recent history.
kubectl describe pod <name>→ see why a pod is CrashLoopBackOffkubectl describe node <node-name>→ check taints, capacity, eventskubectl describe ingress <name>→ verify TLS and backend rules
Events section at the bottom is pure gold during incidents.
3. kubectl logs – Follow What’s Happening Inside
Essential for debugging and monitoring.
kubectl logs -f pod-name -c container-name→ tail live logskubectl logs --since=10m pod-name→ last 10 minuteskubectl logs --previous pod-name→ logs from crashed instance
Even with Loki/Grafana, engineers still reach for kubectl logs first.
Pods in private subnets still expose logs securely through the control plane or NAT Gateway-enabled agents.
4. kubectl exec – Jump Inside a Running Container
The Swiss Army knife for troubleshooting.
kubectl exec -it pod-name -- shkubectl exec -it deploy/my-app -- curl localhost:8080/healthkubectl cp pod-name:/app/logs .→ copy files
5. kubectl top – Real-Time Resource Monitoring
Instant visibility into CPU/memory usage.
kubectl top pods -n productionkubectl top nodes→ spot overloaded workers- Sort with
--sort-by=cpu
6. kubectl port-forward – Instant Local Access
Developers love this for testing without Ingress.
kubectl port-forward svc/my-db 5432:5432→ connect pgAdmin locallykubectl port-forward deploy/api 8080:80→ test API on localhost:8080
Works perfectly even when services are in private subnets – no public exposure needed.
7. kubectl scale – Instant Scaling Up/Down
For emergencies or load tests.
kubectl scale deploy/api --replicas=20kubectl scale statefulset/db --replicas=0→ quick maintenance
8. kubectl apply -f – The Correct Way to Apply Changes
Never use create in production.
kubectl apply -f manifest.yamlkubectl apply -k ./kustomize/overlays/prod- GitOps tools (ArgoCD/Flux) use this under the hood
9. kubectl delete – Clean Up Fast
Sometimes you just need it gone.
kubectl delete pod --grace-period=0 --force pod-name→ kill stuck terminating podkubectl delete ns stuck-namespace --grace-period=0 --force
10. kubectl config Commands – Switch Contexts Like a Pro
Real engineers manage 5–20 clusters daily.
kubectl config get-contexts→ list all clusterskubectl config use-context prod-us-east-1- Alias
kubectxandkubenstools save hours
Essential kubectl Cheat Sheet Table
| Command | Purpose | Real-World Example |
|---|---|---|
kubectl get pods -A |
See all pods cluster-wide | Morning health check |
kubectl describe pod xyz |
Debug failing pod | OOMKilled, ImagePullBackOff |
kubectl logs -f pod --tail=200 |
Live application logs | Error investigation |
kubectl exec -it pod -- sh |
Interactive shell | Check files, curl health |
kubectl top nodes |
Cluster resource usage | Capacity planning |
kubectl port-forward svc/db 5432 |
Local DB access | Developer testing |
Conclusion
Master these 10 kubectl commands and you’ll handle 99% of day-to-day Kubernetes operations with confidence. Combine them with tools like k9s, lens, or stern for even more power. The best engineers have these memorized – and so should you. Bookmark this page, add the aliases to your ~/.zshrc or ~/.bashrc, and watch your productivity soar.
Frequently Asked Questions
What is the most used kubectl command?
kubectl get pods – run hundreds of times per day by most engineers.
Should I use k9s instead of raw kubectl?
Yes for exploration, but know raw kubectl for scripts and incidents.
How do I see why a pod is pending?
kubectl describe pod <name> → look at Events section.
Can I use kubectl with multiple clusters?
Yes – manage contexts with kubectl config use-context.
Is kubectl safe on production clusters?
Yes with RBAC. Most teams grant read-only to developers and full access only to platform team.
What's Your Reaction?
Like
0
Dislike
0
Love
0
Funny
0
Angry
0
Sad
0
Wow
0