My Top 50 kubectl Commands for CKA and Daily Kubernetes Administration

Search for a command to run...

No comments yet. Be the first to comment.
Follow my journey from DevOps Engineer to Kubestronaut as I explore Kubernetes, CNCF certifications, cloud-native technologies, and hands-on learning. In this series, I share my experiences preparing for and passing certifications such as CKA, CKAD, and CKS, along with exam strategies, study resources, troubleshooting lessons, and practical insights gained from real-world Kubernetes environments. Whether you're just starting with Kubernetes or pursuing advanced CNCF certifications, I hope these experiences help guide your own cloud-native journey.
Artificial Intelligence is changing the technology landscape at an incredible pace. Today, AI can: Generate Kubernetes YAML Explain kubectl commands Troubleshoot common issues Build deployment man
Kubernetes Control Plane explained in a practical way for engineers who manage real-world clusters. Introduction When I first started learning Kubernetes, I could create Pods, Deployments, and Service

Kubernetes networking is one of the most important — and often most confusing — topics for beginners. Pods have IP addresses, Services have virtual IPs, DNS magically resolves names, Ingress routes tr

One of the most common questions developers ask when they start working with Kubernetes is: “What actually happens when a user sends a request to my application?” We deploy Pods, create Services, co

Most developers know that Kubernetes can automatically restart failed applications. But have you ever wondered what actually happens behind the scenes when a Pod crashes? When I first started learning

When developers first start learning Kubernetes, they quickly understand Pods and Deployments. You create a Deployment, Kubernetes creates Pods, and your application starts running. Simple, right? Not

Shahzad Ahmad | Kubernetes, DevOps & Cloud Native Journey
32 posts
Senior DevOps Engineer documenting my journey through Kubernetes, CNCF certifications, cloud-native technologies, platform engineering, and automation. Here you'll find hands-on tutorials, certification experiences (CKA, CKAD, CKS), exam strategies, troubleshooting guides, and lessons learned from real-world DevOps and Kubernetes environments. My goal is to share practical knowledge, help others in their cloud-native journey, and ultimately document the path from DevOps Engineer to Kubestronaut.
During my CKA preparation, I realized that one of the biggest differences between knowing Kubernetes and working efficiently with Kubernetes was mastering kubectl.
In the beginning, I understood concepts like Pods, Deployments, Services, and Storage. However, when solving hands-on labs and mock exams, I often found myself spending too much time trying to remember commands or searching for syntax.
Over time, I built a personal list of kubectl commands that I used repeatedly during practice sessions. These commands helped me troubleshoot faster, manage workloads more efficiently, and save valuable time during the exam.
Even after earning the Certified Kubernetes Administrator (CKA) certification, many of these commands remain part of my daily workflow as a DevOps Engineer.
In this article, I’ll share my top 50 kubectl commands, along with the commands I believe every Kubernetes administrator should master.
kubectl is the primary interface for interacting with Kubernetes clusters.
Whether you’re:
Deploying applications
Managing resources
Troubleshooting issues
Monitoring workloads
Configuring networking
Managing storage
kubectl becomes your most important tool.
The faster and more comfortable you are with kubectl, the more effective you’ll be both during the CKA exam and in real-world Kubernetes administration.
If you’re new to Kubernetes or preparing for CKA, start with these commands:
kubectl get pods -A
kubectl describe pod <pod-name>
kubectl logs <pod-name>
kubectl exec -it <pod-name> -- sh
kubectl get events
kubectl get nodes
kubectl get svc
kubectl rollout undo deployment/<deployment-name>
kubectl explain deployment.spec
kubectl top pods
I used these commands almost every day during preparation.
kubectl cluster-info
kubectl version --short
kubectl get nodes
kubectl describe node <node-name>
kubectl get componentstatuses
kubectl get pods
kubectl get pods -A
kubectl get pods -o wide
kubectl describe pod <pod-name>
kubectl delete pod <pod-name>
kubectl run nginx --image=nginx
kubectl get pod <pod-name> -o yaml
kubectl edit pod <pod-name>
kubectl exec -it <pod-name> -- sh
kubectl cp <pod-name>:/tmp/file .
kubectl logs <pod-name>
kubectl logs -f <pod-name>
kubectl logs --previous <pod-name>
kubectl get events
kubectl get events --sort-by=.metadata.creationTimestamp
One of the most common issues during CKA preparation was a Pod stuck in a CrashLoopBackOff state.
My troubleshooting workflow looked like this:
kubectl get pods
kubectl describe pod <pod-name>
kubectl logs <pod-name>
In many cases, these three commands were enough to identify the root cause.
This simple workflow saved me a lot of time during practice exams.
kubectl get deployments
kubectl create deployment nginx --image=nginx
kubectl scale deployment nginx --replicas=5
kubectl set image deployment/nginx nginx=nginx:latest
kubectl rollout status deployment/nginx
kubectl rollout history deployment/nginx
kubectl rollout undo deployment/nginx
kubectl get svc
kubectl describe svc <service-name>
kubectl expose deployment nginx --port=80
kubectl port-forward pod/<pod-name> 8080:80
kubectl get endpoints
kubectl get networkpolicy
kubectl get ns
kubectl create namespace dev
kubectl config set-context --current --namespace=dev
kubectl delete ns dev
kubectl get configmaps
kubectl create configmap app-config --from-literal=env=prod
kubectl get secrets
kubectl create secret generic db-secret \
--from-literal=password=admin123
kubectl get pv
kubectl get pvc
kubectl describe pvc <pvc-name>
kubectl top nodes
kubectl top pods
kubectl top pods -n kube-system
Looking back, these commands would have saved me significant time if I had mastered them earlier:
kubectl explain deployment.spec
kubectl get events
kubectl top pods
kubectl rollout history deployment/nginx
kubectl auth can-i create deployments
The kubectl explain command was particularly useful because it helped me understand resource structures directly from the terminal.
Instead of manually writing YAML, I frequently used:
kubectl run nginx \
--image=nginx \
--dry-run=client \
-o yaml
kubectl create deployment nginx \
--image=nginx \
--dry-run=client \
-o yaml
kubectl explain deployment.spec.template.spec
This command became one of my favorites during preparation.
One of the first things I configured in every lab environment was:
alias k=kubectl
This allowed me to type:
k get pods
instead of:
kubectl get pods
It seems minor, but over hundreds of commands, it saves a surprising amount of time.
I didn’t try to memorize 50 commands overnight.
Instead, I followed a simple process:
Understand what the command does.
Use it repeatedly in labs.
Apply it while fixing real problems.
Build muscle memory through repetition.
Eventually, many commands became second nature.
The difference between a beginner Kubernetes engineer and an experienced administrator is often not knowledge — it’s speed.
Speed comes from repetition.
The more comfortable you become with kubectl, the less time you’ll spend remembering commands and the more time you’ll spend solving problems.
These 50 commands helped me during my CKA preparation and continue to help me in real-world Kubernetes administration every day.
If you’re preparing for the CKA exam, start practicing them today.
Your future self will thank you.
If you’re preparing for Kubernetes certifications, pursuing the Kubestronaut journey, or working in the cloud-native ecosystem, I’d love to connect.
Follow me for more articles on Kubernetes, CNCF certifications, DevOps, Platform Engineering, and Cloud-Native technologies.
LinkedIn: https://www.linkedin.com/in/shahzadaliahmad/
LFX Profile: https://openprofile.dev/profile/shahzadahmad91
Credly: https://www.credly.com/users/shahzadahmad
Website: https://shahzadahmad.dev/
If you found this article helpful, consider sharing it with others in the Kubernetes community.