kubectl describe pod <p>
kubectl logs -f<p>[-c c]
kubectl exec-it<p> -- sh
kubectl get events --sort-by=.metadata.creationTimestamp
kubectl explain pod.spec.containers.resources # in-exam API reference
YAML speed
kubectl create deployment d --image=nginx --dry-run=client -o yaml > d.yaml
# or with alias:
k create deployment d --image=nginx $do> d.yaml
Always scan generated YAML first before adding fields by hand: the scaffold often already has resources, ports, labels, probes, or serviceAccountName. Edit in place instead of duplicating keys.
On apply errors, check the line above the reported line: Kubernetes often points at the symptom, not the typo (missing :, space before :, bad indent, duplicate key).
Fast creation
kubectl create deployment d --image=nginx
kubectl expose deployment d --port=80 --target-port=80
kubectl run bb --image=busybox -it--rm -- sh
kubectl create job j --image=busybox -- echo hi
kubectl create cronjob cj --schedule="*/1 * * * *"--image=busybox -- echo hi
Common failures
Symptom
Cause
HPA no scale
No CPU requests
Deployment no pods
Selector mismatch (immutable)
Readiness wrong
No traffic
Liveness wrong
CrashLoopBackOff
PVC Pending
No StorageClass / mismatch
CreateContainerConfigError
Missing/wrong ConfigMap or Secret name
kubectl short names
Resource
Short
pods
po
replicasets
rs
deployments
deploy
services
svc
namespaces
ns
networkpolicies
netpol
persistentvolumes
pv
persistentvolumeclaims
pvc
serviceaccounts
sa
configmaps
cm
horizontalpodautoscalers
hpa
ingresses
ing
nodes
no
Time management (2h, ~15-20 tasks)
Average: 6-8 min per task; cap hard tasks at 10 min
Answer any order: easy questions first, then hard/debug tasks
Don't get stuck: mark for review after 2 failed attempts or 3 min with no progress
Imperative first: kubectl run, create, expose: faster than YAML from scratch
--dry-run=client -o yaml: generate YAML only when you need custom fields
Set namespace once: kubectl config set-context --current --namespace=<ns>
Delete fast in exam: kubectl delete pod <n> --now (not for production)
Verify before moving on: kubectl get / describe every answer
Per-question loop
Read twice → set context/namespace → create/fix → verify → move on
Phase
Budget
Read + identify resource
1 min
Create / patch / edit
4 min
Verify
1 min
Fix obvious issue
1-2 min
Skip if syntax keeps failing, the root cause is not obvious, or you are rereading the same output without a new hypothesis.
vim shortcuts
gg / G: top / bottom of file
dd: delete line; yy + p: copy/paste line
Shift + D: deletes everything from cursor position to end of line
:set paste: before pasting from clipboard (avoid broken indent)