Exam-day habits: vim, docs, time

A vim setup that behaves in the exam terminal, a time budget per task weight, the read-twice and verify-once routine, how to search the docs, the trap list, and what to do the night before and the morning of.

Foundations30 min2 tasks

After this lesson

  • 01You can configure vim in ten seconds so YAML indents correctly and pasting does not drift.
  • 02You can budget time by task weight and decide in under a minute whether to flag a task and move on.
  • 03You can name the ten most common ways a correct-looking answer scores zero and check for each before leaving a task.

Most CKA failures are not knowledge failures. They are a Deployment created in the wrong namespace, a YAML file with a tab in it, a NodePort outside the allowed range, twenty minutes sunk into a 4% task, or a question answered as remembered rather than as written. These habits are cheap to build on the lab and expensive to skip. Both tasks at the end are deliberately small; the point is the routine, not the Kubernetes.

vim that behaves

First thing on each exam host, right after the kubectl aliasesbash
cat > ~/.vimrc <<'EOF'
set ts=2 sw=2 et nu
EOF
# ts=2  tabstop: a tab displays as two columns
# sw=2  shiftwidth: > and < indent by two spaces
# et    expandtab: the Tab key inserts spaces, never a tab character (YAML rejects tabs)
# nu    line numbers, so error messages like "line 23" mean something

# Inside vim:
#   :set paste        before pasting from the docs (stops auto-indent from staircasing the text)
#   :set nopaste      after, or your Tab key and indentation stop working
#   Ctrl+v  j j j  >  select a block of lines, indent them one shiftwidth; . repeats it
#   Ctrl+v  j j j  <  outdent
#   :%s/old/new/g     replace everywhere; :%s/\t/  /g turns tabs into two spaces
#   :set list         show tabs as ^I so you can find them; :set nolist to hide again
#   u / Ctrl+r        undo / redo;  :w  save;  :q!  quit without saving

The remote desktop has its own clipboard rules: copy and paste in the terminal are Ctrl+Shift+C and Ctrl+Shift+V (or the right-click menu), while Firefox uses the usual Ctrl+C and Ctrl+V. Ctrl+W closes the browser tab you are testing in, so close terminal tabs with Ctrl+Alt+W instead. The Insert key is prohibited in the exam interface; enter insert mode in vim with i and leave it with Esc. tmux is optional: it is nice for a second pane watching kubectl get pods -w, but if you do not already use it daily, a second terminal tab does the same job without new muscle memory on exam day.

Time: one minute per percentage point

Task weightBudgetAt the budget line
2%2 minutesIf it is not done, write what you have, flag it, move on
4%4 minutesSame rule; most 4% tasks are two commands and a check
6 to 8%6 to 8 minutesUsually a multi-step task (RBAC chain, Ingress plus Service, a broken node). Do the parts you are sure of first
Any task after 12 minutesStopFlag it. Nothing in the exam is worth a fifth of your time
Last 20 minutesReserveOne minute per point is about 100 minutes for 100 points; this is what is left. Return to flagged tasks by weight, highest first, then one final verification pass
OrderAs givenWork the tasks in order unless one is obviously long; reordering costs reading time twice. Flag in the interface, not in your head

Read twice, verify once

  • Read the whole task before typing. Then read it again and note the nouns: namespace, names, image tag, replica count, file path, label keys. Half the tasks hide one more requirement in the last sentence.
  • Copy names from the question, never retype them. Select in the question panel, paste into the terminal. web-api and web-apl both look right at 90 minutes in.
  • Host and context first. Follow the infobox: ssh to the named host, and if a context or namespace is given, switch to it before any other command. When the task is done, exit back to the base host.
  • Set the namespace once if the task lives in one: k config set-context --current --namespace=<ns>. Remember you did it; the next task on the same host inherits it.
  • Verify end state, not intent. k get deploy web -n ns -o wide for replicas and image, k get pods -n ns -l app=web for Running, k rollout status for a rollout, cat for a file, k auth can-i ... --as=... for RBAC, curl for a Service or an Ingress.
  • Grep the live object when the question lists fields: k get pod web -o yaml | grep -E 'image:|serviceAccountName|nodeName|tier'. It takes five seconds and catches the wrong tag, the missing label and the Pod that landed on the wrong node.
  • Leave the cluster the way you found it except for what the task asked. A node you cordoned to test something, a tmp Pod you forgot, a namespace switch you did not undo: all of these can break the grader's assumptions on a later task.
TopicType into the kubernetes.io search boxYou want the page titled
Any YAML field you cannot remember(use kubectl explain first; it is faster than any search)
Rollouts, revisions, undodeploymentDeployments
Roles, bindings, verbsrbacUsing RBAC Authorization
Upgrading a kubeadm clusterkubeadm upgradeUpgrading kubeadm clusters
etcd snapshot save and restoreetcd backupOperating etcd clusters for Kubernetes
Draining and cordoningsafely drain nodeSafely Drain a Node
nodeSelector, affinity, anti-affinityassign pods to nodesAssigning Pods to Nodes
Taints and tolerationstaints and tolerationsTaints and Tolerations
Probesliveness readiness startup probesConfigure Liveness, Readiness and Startup Probes
HPAhorizontalpodautoscaler walkthroughHorizontalPodAutoscaler Walkthrough
PV, PVC, access modes, reclaim policypersistent volumesPersistent Volumes
StorageClassstorage classesStorage Classes
Service types, NodePort rangeserviceService
Ingress YAMLingressIngress
Gateway, HTTPRoutegateway apiGateway API
NetworkPolicy YAML, default denynetwork policiesNetwork Policies
DNS names for Services and Podsdns pod serviceDNS for Services and Pods
Static podsstatic podCreate static Pods
kubectl debug, ephemeral containersdebug running podDebug Running Pods
crictl on a nodecrictlDebugging Kubernetes nodes with crictl
CSR approval, client certificatescertificate signing requestsCertificate Signing Requests
Sidecars (init containers with restartPolicy Always)sidecar containersSidecar Containers
KustomizekustomizeDeclarative Management of Kubernetes Objects Using Kustomize
Helm commands(open helm.sh/docs instead and search the command, e.g. helm upgrade)Helm Upgrade

The trap list

  • Wrong namespace. The object exists, it works, and the grader looks in the namespace the question named. -n on every command or set it in the context.
  • Wrong host or context. Same symptom, worse cause. Infobox first, always.
  • No rollout status. You changed the image and moved on; the new Pods never became ready because the tag was wrong; the grader sees the old image still serving. Wait for the rollout, then check -o wide.
  • Editing an immutable Pod field. kubectl edit pod refuses to change volumes, container names, nodeName and more. Write the YAML to a file (k get pod X -o yaml > p.yaml), edit, then k replace --force -f p.yaml. For Pods owned by a Deployment, edit the Deployment instead.
  • NodePort range. 30000 to 32767 by default. A question asking for port 3080 means something else (probably the Service port).
  • maxUnavailable and maxSurge rounding. Percentages round down for maxUnavailable and up for maxSurge. With 3 replicas and 25%, that is 0 unavailable and 1 surge. If a question needs an exact count, write the integer.
  • Secret values. data is base64; stringData is plain text and gets encoded for you. kubectl create secret encodes for you. If you encode by hand, echo -n, or the newline becomes part of the password.
  • Tabs in YAML. expandtab in vim; if a paste went wrong, :%s/\t/ /g.
  • Selector and labels that do not match. A Service with no endpoints, a NetworkPolicy that selects nothing, a Deployment that refuses to create. Compare spec.selector with the Pod template labels character by character.
  • Container name in set image. k set image deploy/web nginx=nginx:1.26 needs the container's name, not the image name. k get deploy web -o jsonpath='{.spec.template.spec.containers[*].name}'.
  • Files in the wrong place. The exact path from the question, created with mkdir -p for the directory, checked with cat. The grader does not search for your file.
  • Forgetting sudo -i on a node and then wondering why /etc/kubernetes/manifests is empty or journalctl -u kubelet shows nothing.
  • The night before: confirm the name on your government-issued photo ID with signature exactly matches your Linux Foundation account; run PSI's system check and the Secure Browser test from the handbook; make sure you have one monitor, a webcam you can move to show the room, and a quiet private room with walls, a door you can close, a clear desk and no bright light or window behind you; uninstall or disable anything that would be flagged (second display, screen-sharing tools); decide which language you want the questions in; sleep.
  • The morning of: eat beforehand, because eating and gum are not allowed during the exam; water in a clear, label-free bottle or glass is. Phone and notes out of the room. Click Take Exam up to 30 minutes early; check-in means an ID photo, a selfie, the agreement and a live room and workspace scan with a check-in specialist, and the wait should not exceed 15 minutes. The handbook does not describe breaks and you may not leave the camera view without the proctor's permission, so plan for none; the clock does not stop either way. Watch or hide the interface tour, and the clock starts.
  • First two minutes: aliases, the vimrc above, k get nodes on the first host to make sure the terminal is yours. Then task one, read twice.

In the docs · the tab you get on exam day

Taskfd-habits-1
Architecture2%~2 min

context · kubectl config use-context kind-cka

Write your exam vimrc

Write the vim configuration you will use on the exam to /tmp/cka/vimrc. It must set tabstop to 2, shiftwidth to 2 and enable expandtab. Short option names are fine. You may add other settings.
  1. 01

    Set up the scenario

    curl -fsSL https://codewithmuh.com/labs/cka/t/fd-habits-1/setup | bash
  2. 02

    Solve it in your terminal

    Work the way the exam makes you: kubectl, the docs, nothing else. Put any answer files under /tmp/cka/.

  3. 03

    Check your work

    curl -fsSL https://codewithmuh.com/labs/cka/t/fd-habits-1/verify | bash
    Counts toward your readiness score.
  4. 04

    Clean up

    curl -fsSL https://codewithmuh.com/labs/cka/t/fd-habits-1/cleanup | bash
Taskfd-habits-2
Workloads3%~4 min

context · kubectl config use-context kind-cka

Read it twice: scale exactly one Deployment

Namespace fd-habits contains several Deployments with similar names. Scale the Deployment billing-api to 3 replicas and add the label tier=backend to that Deployment. Do not modify any other Deployment in the namespace.
  1. 01

    Set up the scenario

    curl -fsSL https://codewithmuh.com/labs/cka/t/fd-habits-2/setup | bash
  2. 02

    Solve it in your terminal

    Work the way the exam makes you: kubectl, the docs, nothing else. Put any answer files under /tmp/cka/.

  3. 03

    Check your work

    curl -fsSL https://codewithmuh.com/labs/cka/t/fd-habits-2/verify | bash
    Counts toward your readiness score.
  4. 04

    Clean up

    curl -fsSL https://codewithmuh.com/labs/cka/t/fd-habits-2/cleanup | bash

Finished reading?

0 of 2 tasks passed. Readiness counts tasks, so run them before you move on.