Skip to main content

Command Palette

Search for a command to run...

My Top 50 kubectl Commands for CKA and Daily Kubernetes Administration

Updated
6 min read
My Top 50 kubectl Commands for CKA and Daily Kubernetes Administration
S
Senior DevOps Engineer with 9+ years of experience across networking, infrastructure, cloud operations, and DevOps. I write about Kubernetes, CNCF certifications, cloud-native technologies, platform engineering, automation, and lessons learned from real-world projects. Currently documenting my journey toward becoming a Kubestronaut while sharing practical insights, study strategies, and hands-on experiences with the Kubernetes ecosystem.

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.

Why kubectl Matters

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 Only Learn 10 Commands, Learn These First

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.

Cluster Administration Commands

Check Cluster Information

kubectl cluster-info

Check Kubernetes Version

kubectl version --short

List Nodes

kubectl get nodes

Describe Node

kubectl describe node <node-name>

View Component Status

kubectl get componentstatuses

Pod Management Commands

List Pods

kubectl get pods

List Pods Across All Namespaces

kubectl get pods -A

Wide Output

kubectl get pods -o wide

Describe Pod

kubectl describe pod <pod-name>

Delete Pod

kubectl delete pod <pod-name>

Create Pod

kubectl run nginx --image=nginx

Export Pod YAML

kubectl get pod <pod-name> -o yaml

Edit Pod

kubectl edit pod <pod-name>

Execute Command Inside Pod

kubectl exec -it <pod-name> -- sh

Copy Files

kubectl cp <pod-name>:/tmp/file .

Logging and Troubleshooting Commands

View Logs

kubectl logs <pod-name>

Follow Logs

kubectl logs -f <pod-name>

View Previous Logs

kubectl logs --previous <pod-name>

List Events

kubectl get events

Sort Events by Timestamp

kubectl get events --sort-by=.metadata.creationTimestamp

Real CKA Troubleshooting Example

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.

Deployment Commands

List Deployments

kubectl get deployments

Create Deployment

kubectl create deployment nginx --image=nginx

Scale Deployment

kubectl scale deployment nginx --replicas=5

Update Image

kubectl set image deployment/nginx nginx=nginx:latest

Check Rollout Status

kubectl rollout status deployment/nginx

Rollout History

kubectl rollout history deployment/nginx

Rollback Deployment

kubectl rollout undo deployment/nginx

Service and Networking Commands

List Services

kubectl get svc

Describe Service

kubectl describe svc <service-name>

Expose Deployment

kubectl expose deployment nginx --port=80

Port Forward

kubectl port-forward pod/<pod-name> 8080:80

View Endpoints

kubectl get endpoints

List Network Policies

kubectl get networkpolicy

Namespace Commands

List Namespaces

kubectl get ns

Create Namespace

kubectl create namespace dev

Switch Namespace

kubectl config set-context --current --namespace=dev

Delete Namespace

kubectl delete ns dev

ConfigMaps and Secrets

List ConfigMaps

kubectl get configmaps

Create ConfigMap

kubectl create configmap app-config --from-literal=env=prod

List Secrets

kubectl get secrets

Create Secret

kubectl create secret generic db-secret \
--from-literal=password=admin123

Storage Commands

List Persistent Volumes

kubectl get pv

List Persistent Volume Claims

kubectl get pvc

Describe PVC

kubectl describe pvc <pvc-name>

Resource Monitoring Commands

Node Resource Usage

kubectl top nodes

Pod Resource Usage

kubectl top pods

Namespace Resource Usage

kubectl top pods -n kube-system

Commands I Wish I Had Learned Earlier

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.

My Favorite CKA Productivity Commands

Generate YAML Quickly

Instead of manually writing YAML, I frequently used:

kubectl run nginx \
--image=nginx \
--dry-run=client \
-o yaml

Generate Deployment YAML

kubectl create deployment nginx \
--image=nginx \
--dry-run=client \
-o yaml

Explain Resource Fields

kubectl explain deployment.spec.template.spec

This command became one of my favorites during preparation.

My kubectl Setup for CKA

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.

My Personal Learning Strategy

I didn’t try to memorize 50 commands overnight.

Instead, I followed a simple process:

Learn

Understand what the command does.

Practice

Use it repeatedly in labs.

Troubleshoot

Apply it while fixing real problems.

Repeat

Build muscle memory through repetition.

Eventually, many commands became second nature.

Final Thoughts

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.

Connect With Me

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.

My Kubestronaut Journey

Part 11 of 32

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.

Up next

AI Can Generate Kubernetes YAML — But Is the CKA Still Worth It in 2026?

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

More from this blog

S

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.