kubectl commands for CKAD 2026kubernetes
00:00:00
Press Esc to exit this exercise.
Global kubectl Commands
kubectl help
kubectl explain <resource>
kubectl explain <resource>.spec
kubectl api-resources
kubectl api-versions
kubectl get all
kubectl get <resource> -o wide
kubectl get <resource> -o yaml
kubectl describe <resource> <name>
kubectl apply -f file.yaml
kubectl delete -f file.yaml
kubectl delete <resource> <name>
kubectl create namespace ns
kubectl config set-context --current --namespace=ns
1. Pods & Containers
Pod creation & inspection
kubectl run pod --image=nginx
kubectl get pods
kubectl describe pod pod
kubectl delete pod pod
Exec & logs
kubectl exec -it pod -- sh
kubectl exec pod -c container -- sh
kubectl logs pod
kubectl logs pod -c container
kubectl logs pod --previous
Pod lifecycle debugging
kubectl get pod pod -o yaml
kubectl get events
kubectl describe pod pod
2. Multi-container Pods
Init containers / sidecars
kubectl apply -f pod.yaml
kubectl describe pod pod
kubectl logs pod -c init-container
kubectl logs pod -c sidecar
3. Volumes & Storage
Ephemeral volumes
kubectl apply -f pod-emptydir.yaml
kubectl describe pod pod
Persistent storage
kubectl get pv
kubectl get pvc
kubectl describe pvc pvc
4. Workload Resources
Deployments
kubectl create deployment app --image=nginx
kubectl get deployments
kubectl describe deployment app
kubectl scale deployment app --replicas=5
Rollouts
kubectl rollout status deployment app
kubectl rollout history deployment app
kubectl rollout undo deployment app
kubectl rollout undo deployment app --to-revision=2
ReplicaSets
kubectl get rs
kubectl describe rs
StatefulSets
kubectl get statefulsets
kubectl describe statefulset sts
DaemonSets
kubectl get daemonsets
kubectl describe daemonset ds
Jobs
kubectl create job job --image=busybox -- echo hello
kubectl get jobs
kubectl describe job job
kubectl delete job job
CronJobs
kubectl create cronjob cj --image=busybox --schedule="*/5 * * * *" -- echo hi
kubectl get cronjobs
kubectl describe cronjob cj
5. Configuration
ConfigMaps
kubectl create configmap cm --from-literal=key=value
kubectl create configmap cm --from-file=app.conf
kubectl get configmaps
kubectl describe configmap cm
Secrets
kubectl create secret generic sec --from-literal=password=123
kubectl create secret generic sec --from-file=key.pem
kubectl get secrets
kubectl describe secret sec
6. Resource Management
Requests & limits
kubectl describe pod pod
kubectl top pod
kubectl top node
Quotas
kubectl create quota q --hard=pods=5
kubectl get quota
kubectl describe quota q
LimitRanges
kubectl get limitrange
kubectl describe limitrange
7. Observability & Debugging
Health probes
kubectl describe pod pod
kubectl get pod pod -o yaml
Debugging
kubectl get events
kubectl describe pod pod
kubectl exec -it pod -- sh
Ephemeral containers
kubectl debug pod -it --image=busybox
kubectl debug pod --image=busybox --target=container
8. Services & Networking
Services
kubectl expose pod pod --port=80 --name=svc
kubectl expose deployment app --type=ClusterIP --port=80
kubectl expose deployment app --type=NodePort --port=80
kubectl get svc
kubectl describe svc svc
Ingress
kubectl get ingress
kubectl describe ingress ing
kubectl apply -f ingress.yaml
NetworkPolicies
kubectl get networkpolicy
kubectl describe networkpolicy np
kubectl apply -f networkpolicy.yaml
9. Security
ServiceAccounts
kubectl get serviceaccounts
kubectl describe serviceaccount sa
kubectl create serviceaccount sa
SecurityContext & Capabilities
kubectl describe pod pod
kubectl get pod pod -o yaml
10. Helm (CKAD-scoped)
helm repo add stable https://charts.helm.sh/stable
helm search repo nginx
helm install myapp chart
helm upgrade myapp chart
helm rollback myapp 1
helm uninstall myapp
11. Kustomize
kubectl kustomize .
kubectl apply -k .
kubectl delete -k .
12. YAML Generation
These commands save minutes in the exam:
kubectl run pod --image=nginx --dry-run=client -o yaml
kubectl create deployment app --image=nginx --dry-run=client -o yaml
kubectl create service clusterip svc --tcp=80:80 --dry-run=client -o yaml
kubectl create configmap cm --from-literal=key=val --dry-run=client -o yaml
kubectl create secret generic sec --from-literal=pwd=123 --dry-run=client -o yaml