Why speed habits come first
The CKA gives you 2 hours for 15 to 20 hands-on tasks. The pass mark is 66%. Your registration includes one retake and two exam simulator sessions, and the certification is valid for two years. Most candidates who run out of time do not lack knowledge. They lose minutes typing YAML by hand, working in the wrong cluster, or scrolling through docs. In this level you build the habits that save those minutes in every later task.
This course is independent of the Linux Foundation and CNCF and is not endorsed by them. It follows CNCF's CKA curriculum (CC BY 4.0). The checks are original practice scenarios, not real exam questions. They do not replace hands-on practice, and no course can promise a pass.
Task 1: Build a multi-node kind cluster
kind (Kubernetes IN Docker) runs each Kubernetes node as a Docker container. kind v0.33.0 uses kindest/node:v1.37.0 by default, which matches the exam's Kubernetes v1.37.
- Install Docker, kubectl and kind (
go install sigs.k8s.io/kind@v0.33.0, or use your package manager). - Save this file as
cka-lab.yaml:
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
- role: worker
- role: worker
- Create the cluster:
kind create cluster --name cka --config cka-lab.yaml
kubectl get nodes
Expected output (ages will differ):
NAME STATUS ROLES AGE VERSION
cka-control-plane Ready control-plane 60s v1.37.0
cka-worker Ready <none> 40s v1.37.0
cka-worker2 Ready <none> 40s v1.37.0
- Create a second cluster so you can practise switching:
kind create cluster --name lab2.
kind names each kubectl context kind-<cluster-name>, so you now have kind-cka and kind-lab2.
Task 2: Switch contexts and namespaces
On the exam, an infobox at the start of each task tells you which host to ssh into and which cluster or namespace to use. If you work in the wrong place, you get no marks for that task. Follow these steps:
- List the contexts. The
*marks the active one:
kubectl config get-contexts
kubectl config current-context
- Switch clusters:
kubectl config use-context kind-cka
- Set the namespace once instead of typing
-non every command:
kubectl create namespace web
kubectl config set-context --current --namespace=web
kubectl config view --minify | grep namespace:
The second command changes only the current context. When you switch back to kind-lab2, it keeps its own namespace.
- Add two shortcuts to
~/.bashrc:
alias k=kubectl
complete -o default -F __start_kubectl k
export do="--dry-run=client -o yaml"
The complete line needs kubectl completion loaded first (source <(kubectl completion bash)).
Task 3: Generate YAML instead of typing it
--dry-run=client builds the object on your machine without sending it to the cluster. Adding -o yaml prints it. You get a valid skeleton in seconds, then edit only what the task asks for.
- Generate the manifests:
k run web-pod --image=nginx:1.27 --port=80 $do > pod.yaml
k create deployment web --image=nginx:1.27 --replicas=3 $do > deploy.yaml
k create deployment web --image=nginx:1.27 --replicas=3 # create it for real
k expose deployment web --port=80 --target-port=80 --type=NodePort $do > svc.yaml
- Edit. For example, open
deploy.yamlinvimand add aresourcesblock under the container. - Apply and verify:
k apply -f deploy.yaml
k get deploy,pods -o wide
Rules of thumb:
- Use
k runfor Pods andk create deploymentfor Deployments. - Use
k expose(it copies the selector) ork create servicefor Services. k exposeneeds the live Deployment so it can read its selector. That is why the steps above create it before exposing it.- Do not use
kubectl applyto generate a skeleton. Run--dry-run=client -o yamlfirst. - If a resource already exists,
k get <kind> <name> -o yaml > file.yamlgives you a starting point.
Task 4: Find a field in under a minute
You will meet fields you do not remember. Try these in order:
kubectl explain. It reads the schema from the API server, so it always matches the cluster's version:
k explain pod.spec.containers.resources
k explain deployment.spec.strategy --recursive
k explain pod.spec --recursive --max-depth=1
--recursive prints the whole tree of nested field names. Use grep to find the one you need, then explain that path to read its description.
- The allowed documentation. During the exam you may open:
kubernetes.io/docs(andkubernetes.io/blog)helm.sh/docsgateway-api.sigs.k8s.io
You may use the search box on kubernetes.io/docs, but do not open external search results. Practise searching for terms like "PersistentVolumeClaim" or "NetworkPolicy" and copying the example YAML. The kubectl Quick Reference page is a good one to know well.
Timed practice task (5 minutes)
Using cluster kind-cka:
- Make
opsthe default namespace for the current context. Create the namespace first if it does not exist. - Create a Deployment
apiwith imagehttpd:2.4, 2 replicas, and a container memory limit of128Mi. - Expose it as a ClusterIP Service
api-svcon port 8080, targeting port 80.
Solution:
k config use-context kind-cka
k create ns ops
k config set-context --current --namespace=ops
k create deployment api --image=httpd:2.4 --replicas=2 $do > api.yaml
# edit api.yaml: under the container add
# resources:
# limits:
# memory: 128Mi
k apply -f api.yaml
k expose deployment api --name=api-svc --port=8080 --target-port=80
k get deploy,svc,endpoints
If you forget where limits goes, run k explain deployment.spec.template.spec.containers.resources.
What the exam asks about this
No task asks you to explain these habits, but every task depends on them. Expect to:
sshto a named host and work in a named cluster or namespace.- Produce correct objects quickly.
- Look up unfamiliar fields in the allowed docs.
If you skip the context instruction, you can lose marks for an otherwise correct answer.
Key takeaways
kind create cluster --name X --config file.yamlbuilds a multi-node lab. Its context iskind-X.kubectl config use-contextswitches clusters.kubectl config set-context --current --namespace=NSsets the default namespace.--dry-run=client -o yamlturns imperative commands into editable manifests.kubectl explain <path> --recursivefinds fields without leaving the terminal.- The allowed docs are kubernetes.io/docs (plus the blog), helm.sh/docs and gateway-api.sigs.k8s.io.