Learn to run CKA tasks faster with kubectl: imperative commands, dry-run YAML, JSONPath, contexts, and timed drills with a cheat sheet and lab.
Priya is 94 minutes into a mock CKA exam with 26 minutes left. Task 11 says to scale a deployment in the payments namespace and expose it.
A good shell setup takes about 30 seconds and saves minutes per task.
Imperative commands create the most common resources in one line, and they are the first thing to reach for on the exam.
Some tasks need a field no imperative flag can set, such as resource limits, a volume, or a nodeSelector.
Most exam tasks end with "verify" or begin with "find out", so inspection speed matters as much as creation speed.
You do not need to remember every field name, because the cluster documents itself.
Priya is 94 minutes into a mock CKA exam with 26 minutes left.
A good shell setup takes about 30 seconds and saves minutes per task.
Imperative commands create the most common resources in one line, and they are the first thing to reach for on the exam.
Some tasks need a field no imperative flag can set, such as resource limits, a volume, or a nodeSelector.
Most exam tasks end with "verify" or begin with "find out", so inspection speed matters as much as creation speed.
You do not need to remember every field name, because the cluster documents itself.
A context is a saved combination of cluster, user and namespace in your kubeconfig.
These drills are written like exam tasks: short, specific and checkable.
Most time lost with kubectl comes from a small set of errors that repeat constantly.
The lab runs on your own machine with two small clusters, so you can practice context switching safely.
Look here only after an honest attempt. If your answer differs but passes the verification, that is fine, because the...
This closing topic is meant to be revisited the night before a practice exam.
Roles that use the skills in this module.
DevOps Engineer
Site Reliability Engineer
Platform Engineer
Not a software engineer sheet. Every problem comes from real DevOps, SRE, Platform and Cloud interviews, from your first script to a system you build yourself.
Open the Coding SheetYou need a small core you can type without thinking: run, create, expose, scale, set image, label, annotate, get, describe, logs and explain. For everything else, kubectl -h and kubectl explain work offline in the exam terminal and are faster than searching the docs. Aim for fluency in a dozen commands rather than memorizing every flag.
Candidates have commonly reported that the exam terminal ships with the k alias and shell completion already configured, but confirm this in the current candidate handbook and in your first minute of the exam. If either is missing, defining them takes about thirty seconds. Practice setting them up so it is automatic.
Run an imperative command with --dry-run=client -o yaml and redirect the output to a file, for example kubectl create deployment api --image=nginx:1.27 --dry-run=client -o yaml > api.yaml. Edit only the fields the task asks for, then apply the file. Use this whenever you need a field that no command flag can set, such as resource limits or a nodeSelector.
A service only gets endpoints when its selector matches the labels of running, ready pods in the same namespace. Compare the selector from kubectl get svc with the labels from kubectl get pods --show-labels. A wrong namespace or a label typo is the usual cause.
With client, kubectl builds the object locally and prints it without asking the API server to validate it. With server, the request goes to the API server, which validates it and runs admission, then discards the object instead of saving it. Use client to generate YAML and server to check that a manifest would really be accepted.
Run kubectl config use-context followed by the context name to change cluster, and kubectl config set-context --current --namespace=name to change the default namespace. Confirm both with kubectl config current-context and kubectl config view --minify. Adding -n to every command is a safer alternative because nothing carries over between tasks.