The kubectl Fluency Baseline
Every one of this course's five CNCF exams — KCNA, KCSA, CKA, CKAD, CKS — assumes you can already operate kubectl, and none of them teaches it to you from scratch. What "operate" means differs sharply by exam: the two knowledge exams only need you to recognize a command's shape on a multiple-choice page, while the three performance exams need you to produce the right command, cold, inside a per-task time budget. This page is the floor underneath both versions of that assumption — not a full tool guide (that's the separate kubectl tool guide, which this page assumes and points back to for mechanics) but the compressed set of reflexes worth owning before you open any blueprint page: setting a context and namespace without thinking, generating a manifest instead of typing one from memory, and reading describe, logs and events in the order that actually finds the fault. It closes with a two-tier self-test, so you find the gaps here, in twenty minutes, rather than mid-task on exam day.
Think about your times tables. When you were first learning them, 7 × 8 meant stopping to add 7 eight times, on your fingers if you had to. That works, but it's slow, and a timed math quiz doesn't wait for you to finish counting. Eventually 7 × 8 just is 56 — no counting, no pause, the answer arrives before you've finished reading the question. kubectl commands work exactly the same way. The first time you need a Role and a RoleBinding for a ServiceAccount, you might look up the flags. By exam day, typing that pair should feel like 7 × 8 — not a lookup, a reflex. This page is the times table. It won't teach you what a Role is — that's a different lesson — it's just the drilling that makes producing one automatic.
kubectl speed the way Remy does, which makes this exact kind of page Remy's department.Why this is a separate page from the kubectl tool guide
☺ Like you're 10: One page teaches you how the remote control works. This one is just the quiz that checks you can already use it without looking.
The kubectl tool guide explains the mechanics in full: the three ways to manage an object and why mixing them causes real incidents, how a kubeconfig's clusters/users/contexts actually fit together, kubectl explain against the live OpenAPI schema, and extending the CLI with krew plugins. Read it once, understand it, and you're done with it — it's reference material, not a drill. This page is different on purpose: it's narrower, it repeats itself less, and it exists to be re-run as a self-test every few weeks while you're actively preparing for one of the five exams. Where the tool guide explains why a mechanism works, this page only cares whether you can produce the command for it inside a few seconds, because that's the actual thing being graded.
Two different fluencies, and why the difference matters more than the commands
☺ Like you're 10: Two of these five tests watch what you type; three of them watch what you build. The same commands matter to both — just not in the same way.
The how-to-study page covers this split for the whole course; here it's worth restating narrowly, because it's the single fact that decides how you should drill. KCNA and KCSA are closed-book multiple choice — there is no terminal in the room, so a question about kubectl logs --previous is testing whether you know what that flag does, never whether you can type it fast. CKA, CKAD and CKS are performance-based: a live terminal against real clusters, roughly 15–20 tasks inside a two-hour window, graded purely on the cluster's end state when the clock stops. Nobody reads your keystrokes and nobody cares if you paste a command from the allowed documentation — but every second spent hesitating over syntax is a second that task's budget didn't have.
That distinction is why the self-test at the end of this page has two tiers instead of one: a recognition tier for KCNA/KCSA, and a speed tier — timed, cold, no docs — for CKA/CKAD/CKS. Marking a speed-tier item "known" because you could explain it is exactly the mistake the study-method page warns about at greater length.
Contexts and namespaces: set them before you touch anything
☺ Like you're 10: Before you press any button on the remote, check which TV it's pointed at. Skip that check and you might turn off the wrong room's television.
This is the single most expensive reflex to skip, on every one of the three performance exams. Each task typically hands you a fresh kubectl config use-context line, and solving task 11 perfectly against task 10's cluster scores exactly zero — the grader checks the cluster the task named, not the one you happened to be looking at. Build the habit of running the context command first, every single task, before reading past the first sentence.
# the four commands that should be reflexive before anything else kubectl config get-contexts # every context, current one marked with * kubectl config current-context # just the pointer, nothing else kubectl config use-context k8s-c1-H730593 # flip it — copy the exact name from the task kubectl config set-context --current --namespace=shop # default namespace for every bare command that follows # confirm both at once, without scrolling a whole file kubectl config view --minify | grep -E 'current-context|namespace'
Two habits close the rest of the gap. First, don't trust your eyes on a shared terminal — a shell prompt that prints the live context and namespace (most prompt frameworks have a Kubernetes segment) catches a stale pointer before you type the destructive command, not after. Second, once a namespace is set for the task, drop -n from every subsequent command rather than re-typing it and risking a typo that silently switches you elsewhere — that's the entire point of set-context --current --namespace=. The full kubeconfig structure — how clusters, users and contexts actually fit together, and the ctx/ns krew plugins that make switching faster still — is in the tool guide's contexts section; this page only needs you to be able to run the four commands above without a pause.
Ask anyone who has sat CKA, CKAD or CKS what they'd change, and "I solved a task in the wrong cluster" appears constantly. It's not a knowledge failure — every candidate who makes this mistake could have recited the context command from memory five minutes earlier. It's a habit failure: the context switch has to happen before you start reading the task, every time, on reflex, not as a step you remember to do when you think of it.
The dry-run reflex: your manifest generator wall
☺ Like you're 10: Instead of typing a whole recipe from memory, you say what dish you want and the kitchen hands you a starting recipe card — correct format, right sections, nothing missing.
The tool guide explains why --dry-run=client -o yaml works and how it differs from --dry-run=server; this page is the wall of generators worth having cold, because CKAD and CKS in particular expect you to scaffold a wide range of object kinds fast, not just Deployments. Set the shorthand up before task one, then never hand-type YAML boilerplate again:
alias k=kubectl export do='--dry-run=client -o yaml' source <(kubectl completion bash) # or zsh — tab-complete every resource and flag complete -o default -F __start_kubectl k # completion follows the alias too
k create deployment web --image=nginx:1.27 --replicas=3 $do > deploy.yaml k create service clusterip web --tcp=80:8080 $do > svc.yaml k expose deployment web --port=80 --target-port=8080 $do # Service scaffolded FROM an existing object k create configmap app-cfg --from-literal=LOG_LEVEL=debug $do k create secret generic db-cred --from-literal=password=s3cr3t $do k create serviceaccount builder $do k create role reader --verb=get,list,watch --resource=pods $do k create rolebinding reader-binding --role=reader --serviceaccount=shop:builder $do k create clusterrole node-reader --verb=get,list --resource=nodes $do k create clusterrolebinding node-reader-binding --clusterrole=node-reader --serviceaccount=shop:builder $do k create job one-off --image=busybox $do -- echo hello k create cronjob nightly --image=busybox --schedule="0 2 * * *" $do -- echo hi k create ingress web-ing --rule="shop.example.com/=web:80" $do k create namespace team-a $do
One trap sits inside that list on purpose: k create deployment scaffolds a Deployment, but kubectl run scaffolds a bare Pod — the imperative pod/RC/deployment "generator" flags were removed years ago, so kubectl run web --image=nginx today always means "just a Pod." Reaching for run when a task actually wants a Deployment is a fast, silent way to fail a task that looked easy. If you genuinely want a lone Pod for a quick test, run is exactly right; if you want anything self-healing, reach for create deployment instead.
Treat the generator wall as a lookup table by noun, not by memorized syntax: "I need a Role" → create role; "I need to grant it" → create rolebinding --serviceaccount=; "I need traffic to reach a Deployment" → expose deployment. Once the noun-to-verb mapping is automatic, the flags themselves come from tab completion and --dry-run catches the rest — you're never reconstructing YAML indentation from memory under a clock.
describe, logs, events: the triage order
☺ Like you're 10: Three different questions, three different tools. Ask "why won't it start," "what did it say before it died," and "what's been happening around here" in that order, and you'll almost never guess wrong.
This triage order carries most of CKA's Troubleshooting domain — the single largest domain on that exam at 30% — and it's just as central to CKAD and CKS once something in a task doesn't come up the way it should. Each of the three commands answers a genuinely different question, and reaching for the wrong one first is how a five-minute fix turns into fifteen.
# 1. the object's own story, resolved spec plus its recent events kubectl describe pod checkout-7d9f4c-x8k2q # 2. the dead container's last words — --previous is the whole trick for a crash loop kubectl logs checkout-7d9f4c-x8k2q -c app --previous kubectl logs -f checkout-7d9f4c-x8k2q --since=10m # tail the live container instead # 3. the neighborhood, newest last, narrowed to one object if you have a suspect kubectl get events -n shop --sort-by=.lastTimestamp kubectl get events -n shop --field-selector involvedObject.name=checkout-7d9f4c-x8k2q
describe's events section and get events are drawing on the same underlying objects, but they're not interchangeable: describe shows only the events attached to the one object you named, in a stable snapshot at the moment you ran it, while get events --sort-by=.lastTimestamp shows everything in the namespace, newest last, including things that happened to other objects that might be the actual cause — a full disk on the node, a failing admission webhook, a NetworkPolicy that just got applied. When describe comes back clean and the symptom persists, that's the signal to widen the net rather than staring at the same object harder.
"People assume I'm fast because I skip steps. I don't — I run the same three commands in the same order every single time, describe, logs, events, and I never once wonder which to try first because there's no decision left to make. The speed isn't from knowing more. It's from never having to think about what to check next, so all my thinking goes into the actual problem instead of the triage order."
Beyond read-and-generate: edit, patch, verify, roll back
☺ Like you're 10: Once you know how to look and how to build, you need to know how to change something that already exists, prove the change worked, and undo it if it didn't.
A handful of commands round out the reflex set, mostly by letting you change or verify a live object without re-writing its whole manifest:
# targeted edits without opening the whole file again
kubectl set image deployment/web web=nginx:1.28
kubectl scale deployment/web --replicas=5
kubectl patch deployment web -p '{"spec":{"replicas":5}}' # strategic merge, the default
kubectl patch deployment web --type=json -p='[{"op":"replace","path":"/spec/replicas","value":5}]'
kubectl edit deployment web # opens the live object in $EDITOR
# did the change actually land, and would a re-apply be safe?
kubectl rollout status deployment/web --timeout=90s
kubectl rollout history deployment/web
kubectl rollout undo deployment/web --to-revision=2
kubectl diff -f deploy.yaml # what apply WOULD change, before it changes it
kubectl get pods -l app=web -w # watch it converge instead of polling
# proving an RBAC grant works, rather than trusting that it applied cleanly
kubectl auth can-i list secrets -n shop --as=system:serviceaccount:shop:builder
kubectl auth can-i --list -n shop --as=system:serviceaccount:shop:builderkubectl explain belongs on this list too — kubectl explain deployment.spec.strategy --recursive is faster than a search engine and always matches the exact API version the cluster is running — but the tool guide already covers it at full depth, so it isn't repeated here. The one habit worth adding on top of all of the above: a task on a performance exam is complete when you've proved it, not when you've applied it. rollout status came back clean, auth can-i said yes, get -o jsonpath printed exactly the value the task asked for — budget the last twenty seconds of every task for that check, because applying a manifest and immediately moving on is how candidates walk out confident and score lower than they expected.
| Command family | KCNA | KCSA | CKA | CKAD | CKS |
|---|---|---|---|---|---|
| Contexts & namespaces | Low | Low | Critical | Critical | Critical |
| Dry-run generators | Low | Low | High | Critical | High |
| describe / logs / events | Medium | Low | Critical | High | Medium |
| Edit / patch / rollout | Low | Low | High | Critical | Medium |
auth can-i verification | Medium | High | Medium | Low | Critical |
What KCNA and KCSA actually need from all of this
☺ Like you're 10: If there's no terminal in the room, you don't need fast fingers — you need to be able to picture what the command would do and pick the true sentence about it.
It's tempting to skip this whole page if you're only sitting KCNA or KCSA — after all, neither hands you a terminal. That's a real mistake, just not the one it looks like. Both exams draw heavily on scenario questions that describe a symptom and ask which command or which cause explains it: "a Pod is stuck in Pending — which of the following would kubectl describe most likely reveal?" You don't need to type the command, but you absolutely need to know what output it produces and why, which means the fastest route to a correct answer is having actually run it enough times that the shape of its output is familiar rather than abstract. KCSA leans further into auth can-i and RBAC verification specifically, because "how would you confirm this ServiceAccount cannot read Secrets" is a natural security-knowledge question even with no terminal to run the check in.
So the honest instruction for KCNA/KCSA candidates is: work through every command block on this page on a real cluster — kind or minikube both make this free — not to build typing speed, but so the multiple-choice options stop being abstract vocabulary and start being things you recognize on sight, the way a recipe reads differently once you've actually cooked it.
This course is an independent, unofficial study resource, not affiliated with the CNCF or the Linux Foundation. Figures like exam duration, task count and pass mark — the ~2 hours and ~15–20 tasks referenced on this page, and the CKS-requires-active-CKA prerequisite — reflect what is generally published, and every one of them has changed at some point in these exams' history and can change again. Confirm current details on the official CNCF certification pages and the Linux Foundation training site before you register.
On any throwaway cluster, time yourself against this exact sequence, out loud, without looking anything up: set your context and namespace; generate a Deployment, a ConfigMap and a Secret with --dry-run=client -o yaml; apply all three; delete one Pod and watch get pods -w replace it; force a failure on purpose (typo an image tag) and run the full triage — describe, then logs --previous, then get events --sort-by=.lastTimestamp — to find it; fix it; then prove the fix with rollout status. If any single step makes you pause to think about syntax rather than about the cluster, that step is not a reflex yet — it's this week's practice, not exam week's.
Remy: Quick check before anyone touches anything — what's the current context, and what namespace are we in?
Foxy: Does it matter? I'm just going to describe the Pod, not delete anything.
Remy: It always matters. "Just looking" in the wrong cluster still wastes your only clock, and on the real exam it can waste a whole task's clock. Say it out loud, every time, before you type anything else.
Gizmo the Gremlin: Or — hot tip — just memorize one giant YAML file for every object type and paste chunks of it from memory. Way more impressive than typing a generator command. 🤑
Benny the Beaver: Impressive and wrong the moment a field's default changes between versions. I'd rather generate a correct skeleton in two seconds than recite a maybe-stale one from memory.
Timmy the Turtle: And for anything touching RBAC, memorized YAML proves nothing anyway. Generate it, apply it, then run auth can-i --as= the actual ServiceAccount. Only the verification counts.
Remy: Which is the whole page in one sentence: generate, don't recall — then prove it, don't assume it.
Self-test: two tiers, scored honestly
☺ Like you're 10: Tick a box only if you could actually do the thing right now, with nobody helping. An empty box just found you twenty minutes of useful practice.
Tier 1 is the recognition floor every exam on this ladder needs, KCNA and KCSA included. Tier 2 is the speed floor, and it's specific to CKA, CKAD and CKS — read each item as a literal instruction with an implied stopwatch, and only tick it if you could do it cold, on a live cluster, right now.
- ① Tier 1 — recognition (every exam)
- ② Tier 2 — speed, cold, on a live cluster (CKA / CKAD / CKS)
Anything left unticked in Tier 2 is your next practice session — not a reading assignment, a stopwatch session on a real cluster. The flashcards and self-check quiz reinforce Tier 1; nothing but repetition on a live cluster builds Tier 2.
1. Which two exams in this course only need you to recognize a kubectl command rather than type it, and why does that change how you should study it? 2. What does kubectl run web --image=nginx actually create, and how does that differ from what most people expect it to create? 3. Put the three triage commands — describe, logs --previous, get events --sort-by=.lastTimestamp — in the order this page recommends running them, and say what each one specifically answers. 4. What does kubectl config set-context --current --namespace= change, and why is running the context command first, every task, considered the single most-repeated regret on the performance exams? 5. Why isn't applying a manifest, by itself, considered a finished task on a performance exam — what step does this page say to budget time for at the end of every task?
Check your answers
- KCNA and KCSA — both are closed-book multiple choice with no terminal in the room, so drilling them means running the commands enough on a real cluster that their output becomes familiar, not memorizing syntax you'll never type under exam conditions.
kubectl runalways creates a bare Pod — the old imperative generator flags that let it create Deployments or ReplicationControllers were removed years ago. Most people expect it to create a Deployment the waykubectl create deploymentdoes; conflating the two is a quiet, common way to fail a task that asked for something self-healing.- First
kubectl describe(the object's own story plus its recent events — "why won't this start?"), thenkubectl logs --previous(the dead container's last stdout/stderr — "why did the process inside fail?"), thenkubectl get events --sort-by=.lastTimestampif the picture is still unclear (the broader recent history of the namespace, since events are short-lived and namespaced). - It sets the default namespace that every subsequent bare kubectl command in that context uses, so you stop needing
-non every line. Running the context command first matters because each task typically points at a specific cluster, and solving a task perfectly in the wrong cluster scores zero — candidates repeat this exact regret constantly. - Because the performance exams grade the cluster's end state, not your intent — applying a manifest doesn't confirm it actually took effect, an RBAC grant doesn't confirm the identity can really do the thing, and a rollout doesn't confirm it finished. This page recommends budgeting the last twenty seconds of every task to verify with something like
rollout status,auth can-i, orget -o jsonpathbefore moving on.