CKA prep, by exam domain · Lesson 1 of 12 · about 35 minutes

The CKA exam, and setting up your terminal

What the Certified Kubernetes Administrator (CKA) exam really tests, how its five domains are weighted, and the terminal setup worth doing in its first two minutes. You'll build the three practice machines this track runs on, set up the exam terminal, and find out that generating YAML doesn't need a cluster at all.

By the end you'll know

  • What the CKA exam is, how it's run and how it's scored
  • The five domains, and why their weights should decide how you study
  • How the drills in this track work, and what "ready" looks like
  • How to set up the terminal the way you'll use it in the exam: an alias, tab completion and two shortcuts
  • Why --dry-run=client works with no cluster at all, and why that matters
  • What localhost:8080 in an error really means, and why not to reach for --validate=false
  • The pasted-block trap that catches people logging in to a machine

Before you start

  • You need: Vagrant (opens in a new tab) and VMware Fusion or VirtualBox, as in the Linux track from Lesson 7 on, and about 6 GB of free memory for three small machines.
  • You should know: the basics from the Kubernetes track. This track is about doing it fast and under pressure, not learning it for the first time.
  • The practice folder: git clone https://github.com/Kwamib/cka-practice.git
  • The output below is from real runs on the evening of November 23, 2026, in New York, on an Apple silicon Mac.

What the exam is

The Certified Kubernetes Administrator (CKA) is a hands-on exam from the Linux Foundation and the Cloud Native Computing Foundation (CNCF). There's no multiple choice. For two hours, you work in a real terminal on real clusters, doing tasks like "this node is NotReady, fix it" or "give this account permission to list pods in one namespace."

The essentials, as of late 2026:

WhatThe detail
FormatAbout 15 to 20 hands-on tasks, across several clusters
Time2 hours
To pass66%
RetakeOne free retake is included
Open bookYes: the official Kubernetes documentation, in a browser inside the exam
PracticeTwo sessions on an exam simulator come with your registration, 17 questions each, with 36 hours of access per session
Kubernetes versionRecent: v1.37 at the time of writing

Check the official CKA page (opens in a new tab) before you book. The version, the price, the passing score, how long the certification lasts and the documentation you may open all change over time, and plenty of guides online are out of date. The curriculum was reworked in 2025, adding Helm, Kustomize, custom resources and the Gateway API, so a guide from before then is missing a fifth of the exam.

Think of a driving test, not a written one. Nobody asks you to describe a three-point turn: you do one, in real traffic, with someone watching the clock. Knowing how isn't enough; you have to do it smoothly, first time, under a little pressure. That's why this track is built around drills you repeat until they're automatic.

The five domains

The exam's tasks come from five domains, each worth a fixed share of the score:

DomainWeightIn this track
Troubleshooting30%Lessons 3 and 4
Cluster architecture, installation and configuration25%Lessons 2, 5, 6 and 7
Services and networking20%Lessons 8 and 9
Workloads and scheduling15%Lesson 10
Storage10%Lesson 11

The weights should decide where your study time goes. Troubleshooting is almost a third of the score, and it's the domain where people who "know Kubernetes" most often struggle: under pressure, they jump straight to the logs and stay there. It gets two full lessons and a fixed method. Storage is a tenth: worth knowing well, but not worth a week.

How this track works

Every lesson after this one follows the same pattern: a real lab on the practice cluster you're about to build, the reasons behind each step, what went wrong when I did it, and then drills.

A drill is a task to do from a blank terminal, worded the way a real task might be. Try it first, without looking. Then open "Show the fast way" to compare your commands, and read the notes under them: they cover the part people usually get wrong.

Come back to a drill a few days later and do it again without looking at your last attempt. Getting it right twice, from nothing, is what makes it stick.

What "ready" looks like, before you book:

  • Every drill in the track done cold, without looking anything up, on two different days.
  • Both simulator sessions done. The simulator's makers say it's harder than the real exam, on purpose: use the first as a check a couple of weeks out, and the second as a final rehearsal.
  • The timed mock exam in Lesson 12, finished inside two hours with time left to check your work.
  • You can break the practice cluster in a way you haven't seen before, and fix it using the method from Lesson 3, without a lesson open.

The practice machines

Every lesson runs on a cluster you build yourself: three Ubuntu virtual machines on your own computer, one to run the control plane (the cluster's brain) and two workers to run apps. It's the closest you can get to the exam's clusters for free, and building it is itself on the exam.

This lesson builds the three machines and sets up the terminal. Lesson 2 turns them into a cluster.

(Your machine)

BASH
cd cka-practice
vagrant up 2>&1 | tee up.log
tail -15 up.log
  • vagrant up: builds cp1, worker1 and worker2, and runs node-setup.sh on each one.
  • 2>&1: includes error messages with the normal output.
  • | tee up.log: shows everything on screen and saves a copy in up.log, so nothing is lost if it scrolls away.
  • tail -15 up.log: prints the last 15 lines.

It takes 10 to 15 minutes. Each machine ends the same way:

OUTPUT
    cp1: == ready: cp1 has v1.36.6, containerd 2.2.1
    cp1:    The kubelet restarts every few seconds until this node joins a cluster. That's normal.
...
    worker1: == ready: worker1 has v1.36.6, containerd 2.2.1
...
    worker2: == ready: worker2 has v1.36.6, containerd 2.2.1

node-setup.sh does what the kubeadm documentation says a machine needs before it can join a cluster:

  • Swap off. The kubelet, the agent that runs pods on each node, refuses to start with swap on by default: Kubernetes needs to know exactly how much real memory a node has.
  • Two kernel modules and three network settings, so container traffic can cross the network bridges and be forwarded between machines.
  • containerd, the container runtime that actually runs the containers, set to the systemd cgroup driver.
  • kubeadm, kubelet and kubectl at v1.36, held at that version so ordinary updates can't change them.

Why v1.36, when the exam uses v1.37? On purpose. Lesson 5 upgrades the cluster to the exam's version, for real, which is named in the exam's curriculum.

You may also see a line like this, for each machine:

OUTPUT
==> cp1: Fixed port collision for 22 => 2222. Now on port 2250.

Each machine needs its own port on your computer for SSH, and 2222 was already taken, probably by a machine from another lab. Vagrant picked a free port by itself. vagrant ssh knows which, so there's nothing to do.

One setting worth checking

The kubelet and containerd both track how much CPU and memory each container uses, through Linux cgroups (control groups). They must agree on how. If they don't, pods restart for no obvious reason, which is one of the hardest setup problems to spot later. node-setup.sh sets containerd to use systemd for this, the same as the kubelet.

containerd 2 reorganized its settings file, and older setup guides change a setting that may not exist any more. So check, rather than trust:

(On cp1)

BASH
vagrant ssh cp1
BASH
sudo grep -n SystemdCgroup /etc/containerd/config.toml
OUTPUT
109:            SystemdCgroup = true
  • grep -n: finds the line, and shows its line number.

true: they agree.

The pasted-block trap

I first pasted vagrant ssh cp1 and all the commands after it as one block. Only the first line did anything useful: vagrant ssh opened a new session on the machine, and the lines after it never reached it. They were either lost while the connection started, or left waiting to run on my own computer after I logged out. Log in first, then paste. The same goes for ssh to any node: connect, wait for the new prompt, then run the commands.

Set up the exam terminal

The first two minutes of the exam are worth spending on this. Every task after saves seconds, and seconds add up across 15 to 20 tasks.

(On cp1)

BASH
cat >> ~/.bashrc <<'EOF'
alias k=kubectl
source <(kubectl completion bash)
complete -o default -F __start_kubectl k
export do="--dry-run=client -o yaml"
export now="--force --grace-period 0"
EOF
printf 'set tabstop=2 shiftwidth=2 expandtab\n' >> ~/.vimrc
source ~/.bashrc
  • cat >> ~/.bashrc <<'EOF' ... EOF: adds the lines between the EOFs to the end of your shell's startup file, so they apply every time you log in. >> adds to the file instead of replacing it.
  • alias k=kubectl: type k instead of kubectl. You'll type it hundreds of times.
  • source <(kubectl completion bash): Tab completes kubectl's commands, resource types and even the names of your pods.
  • complete -o default -F __start_kubectl k: the same tab completion for k. Without this line, Tab works for kubectl but not for the alias.
  • export do=... and export now=...: two shortcuts, saved as shell variables. How they work is explained below.
  • set tabstop=2 shiftwidth=2 expandtab: in Vim, indent with two spaces, and turn Tab into spaces. YAML doesn't allow tab characters, and a mix of tabs and spaces is one of the commonest ways to break a file you're editing under time pressure.
  • source ~/.bashrc: loads the new settings now, without logging out.

If Tab prints _get_comp_words_by_ref: command not found

That happened to me on cp1: I typed k apply -f web and pressed Tab, and got bash: _get_comp_words_by_ref: command not found. kubectl's completion script relies on helper functions from a separate package, bash-completion, which this machine didn't have. The fix:

BASH
sudo apt-get install -y bash-completion
source /usr/share/bash-completion/bash_completion
source ~/.bashrc

The practice folder's node-setup.sh now installs it, so a fresh vagrant up won't hit this. On any other Linux machine, it's the first thing to check when kubectl's Tab completion fails.

The exam environment may have the alias and tab completion set up already. Check with type k before you add anything. The two shortcuts and the Vim settings you add yourself.

BASH
type k
k version --client
OUTPUT
k is aliased to `kubectl'
Client Version: v1.36.6
Kustomize Version: v5.8.1
  • type k: says what k really is.
  • --client: shows kubectl's own version without contacting a cluster.

Notice Kustomize in the output. kubectl has it built in, so k apply -k works with nothing else installed. That matters in Lesson 7.

Let kubectl write the YAML

Writing YAML from scratch is slow, and one of the easiest ways to lose time in the exam. kubectl can write it for you, and the do shortcut makes that quick to ask for.

How the shortcut works

This line in your .bashrc created it:

BASH
export do="--dry-run=client -o yaml"
  • do="...": saves the text between the quotes in a shell variable called do. A variable is just a name for a piece of text.
  • export: makes the variable available to every command you run in that shell, not just the line that set it.

When you type $do, with a dollar sign, the shell replaces it with the saved text before running the command. kubectl never sees $do. So these two lines are exactly the same:

BASH
k create deploy web --image=nginx $do
kubectl create deploy web --image=nginx --dry-run=client -o yaml

The two flags it stands for:

  • --dry-run=client: work out what the command would create, but don't create it.
  • -o yaml: print the result as YAML.

To see what a variable holds, echo $do prints --dry-run=client -o yaml.

Use it without quotes: $do, not "$do". Without quotes, the shell splits the text at the spaces into three separate words, --dry-run=client, -o and yaml, which is what kubectl expects. In quotes, it would arrive as one long word, and kubectl would reject it. Normally you quote variables to be safe; here, the splitting is the point.

YAML without a cluster

There's no cluster yet. Does it work anyway?

BASH
k create deploy web --image=nginx $do
OUTPUT
apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: web
  name: web
spec:
  replicas: 1
  selector:
    matchLabels:
      app: web
  strategy: {}
  template:
    metadata:
      labels:
        app: web
    spec:
      containers:
      - image: nginx
        name: nginx
        resources: {}
status: {}

It does. A client-side dry run happens entirely in kubectl, on your machine. It never talks to a cluster. That's what "client" means, as opposed to --dry-run=server, which sends the request to the cluster to be checked but not saved.

Compare that with a command that does need a cluster:

BASH
k get nodes
OUTPUT
E1124 02:22:11.628966    8556 memcache.go:265] "Unhandled Error" err="couldn't get current server API group list: Get \"http://localhost:8080/api?timeout=32s\": dial tcp 127.0.0.1:8080: connect: connection refused"
...
The connection to the server localhost:8080 was refused - did you specify the right host or port?

localhost:8080 is the clue. kubectl finds its cluster in a configuration file, ~/.kube/config, called a kubeconfig. When there isn't one at all, kubectl falls back to trying localhost:8080, and nothing is there. So this error doesn't mean "the cluster is down". It means "this kubectl doesn't know which cluster to talk to." It usually means you're on a node, or using an account, without a kubeconfig. Lesson 2 creates the cluster and its kubeconfig, and this command starts working.

A dry run only prints. It saved no file and created nothing, which is easy to assume otherwise. To keep the YAML, send it into a file:

BASH
k create deploy web --image=nginx $do > web.yaml
ls -ltr
OUTPUT
total 4
-rw-rw-r-- 1 vagrant vagrant 320 Nov 24 02:53 web.yaml
  • > web.yaml: sends the output into a file called web.yaml, instead of to the screen.
  • ls -ltr: lists files in long form (-l), sorted by time (-t), newest last (-r).

So the exam habit is: generate, save, edit, apply.

BASH
k create deploy web --image=nginx --replicas=3 $do > web.yaml
vim web.yaml
k apply -f web.yaml

Edit only what the task asks for, then k apply -f web.yaml creates it on the cluster. That last step needs a cluster, so it works from Lesson 2 on.

Try it now anyway, and the error is different:

BASH
k apply -f web.yaml
OUTPUT
error: error validating "web.yaml": error validating data: failed to download openapi: Get "http://localhost:8080/openapi/v2?timeout=32s": dial tcp 127.0.0.1:8080: connect: connection refused; if you choose to ignore these errors, turn validation off with --validate=false

Before sending anything, apply validates the YAML against the cluster's OpenAPI schema: the cluster's own list of which fields each kind of object allows. It has to download that from the API server, and there isn't one.

Don't take the suggestion at the end. --validate=false sounds like a fix, but it only moves the failure one step later: apply still has to send the Deployment to a cluster. On a real cluster, it would also hide genuine mistakes in your YAML. The cause is the same as before, and localhost:8080 gives it away: no kubeconfig, no cluster. When an error suggests a workaround, find the cause first.

Three details in that output are worth noticing:

  • The container is named nginx, after the image, not web, after the Deployment. Tasks that ask you to change "the container's image" need that name: k set image deploy/web nginx=nginx:1.28.
  • strategy: {}, resources: {} and status: {} are empty. They're harmless. Leave them, or delete them if they clutter the file.
  • replicas: 1 is the default. Most k create commands take flags, like --replicas=3, so you edit less.

The other shortcut, $now, works the same way and stands for --force --grace-period 0. Normally a deleted pod gets about 30 seconds to shut down cleanly. k delete pod web $now skips that wait. Use it in the exam, where a pod you're replacing doesn't need a clean shutdown. Don't make it a habit on real clusters, where that 30 seconds is the app finishing its work.

On exam day

  • Run the task's setup command first, every task. If a task gives a command to pick its cluster or machine, like kubectl config use-context NAME or an ssh command, copy it and run it before anything else. Work done on the wrong cluster isn't the task.
  • Read the whole task before typing, including the namespace. When a task names one, a resource in default isn't what it asked for.
  • Skip what you're stuck on. If tasks show their weight, use it to decide. Do the quick ones, flag the hard ones, and come back.
  • Check your work: k get what you made, and k describe it if anything looks off. A typo in a label means the task isn't done.
  • Use the docs for long YAML. Network Policies, affinity rules and PersistentVolumes are meant to be copied from the documentation's examples and edited, not typed from memory.

Clean up

Nothing to delete: you'll use these machines in every lesson. When you're done for the day:

(Your machine)

BASH
exit
vagrant halt
  • exit: leaves cp1.
  • vagrant halt: shuts the three machines down, keeping everything on them. vagrant up starts them again in about a minute, without running the setup again.

In real life

  • Pin versions on real clusters too, as node-setup.sh does with apt-mark hold. An unplanned Kubernetes upgrade, from an ordinary apt upgrade on a node, is a real way to break a cluster.
  • Managed services do this setup for you. Amazon EKS, Azure AKS and Google GKE prepare the nodes, so you may never run node-setup.sh at work. The CKA still expects you to understand it, because when a managed node breaks, these are the parts that broke.
  • --dry-run=server is the safer check on a real cluster: the cluster validates the object, including its admission rules, without saving it.

Spot the problem

Work out what's wrong before you read the explanation.

"The cluster is down." You SSH to a control plane node to check something, and run kubectl get pods. It says The connection to the server localhost:8080 was refused. Your teammate's instinct is to restart the API server. What's really going on? The cluster is probably fine. kubectl on that node, for that user, has no kubeconfig, so it's trying the fallback address localhost:8080. A broken API server gives a different error: the real address, usually ending in :6443, and "connection refused" or a timeout. Here, either go back to the machine you were working from, or point kubectl at the admin kubeconfig: export KUBECONFIG=/etc/kubernetes/admin.conf (as root). Read the address in the error before you fix anything.

"My alias works, but Tab doesn't." Someone adds alias k=kubectl and source <(kubectl completion bash) to their .bashrc. kubectl get po then Tab completes to pods, but k get po then Tab does nothing. What's missing? The completion was set up for the word kubectl, not for the alias. Bash completes each command by its own name, so k needs its own line: complete -o default -F __start_kubectl k. __start_kubectl is the completion function that kubectl completion bash defines; this line tells Bash to use the same one for k.

Keep this

ToUse
Type lessalias k=kubectl
Tab completion for kubectl and ksource <(kubectl completion bash), then complete -o default -F __start_kubectl k
Generate YAML instead of writing itexport do="--dry-run=client -o yaml", then k create ... $do > file.yaml
Delete without waitingexport now="--force --grace-period 0", then k delete pod NAME $now
Safe YAML in Vimset tabstop=2 shiftwidth=2 expandtab in ~/.vimrc
Check what a name istype k
kubectl's version, without a clusterk version --client
See localhost:8080 in an errorkubectl has no kubeconfig here: wrong machine or user, or use KUBECONFIG=/etc/kubernetes/admin.conf
Before every taskThe task's own setup command, such as kubectl config use-context NAME

Where you are now

You know what the curriculum covers and how its score is weighted, you have three practice machines ready to become a cluster, and your terminal is set up the way you'll use it in the exam. You've seen that --dry-run=client writes correct YAML with no cluster at all, so you'll rarely write YAML from scratch. Lesson 2 turns the three machines into a working cluster with kubeadm.

Check yourself

  1. You have 10 hours of study time left. Your two weakest areas are storage and troubleshooting. Going by the exam's weights, which should get most of those hours?

  2. With no cluster running at all, you run k create deploy web --image=nginx $do > web.yaml. What ends up in web.yaml?

  3. kubectl get po then Tab completes to pods, and k get po runs fine. But k get po then Tab does nothing. Which .bashrc line is missing?

  4. kubectl apply rejects a file you just edited in Vim with a YAML parse error, although the indentation looks right. What's the likely cause?

  5. You paste vagrant ssh cp1 and five more commands as one block. After you later type exit, you see Password: and a zsh error. What happened?

  6. An exam task starts with kubectl config use-context k8s-c2. You skip it, fix the problem, and your check shows it fixed. Why might the task still score zero?

Key terms

  • CKA (Certified Kubernetes Administrator): a two-hour, hands-on Kubernetes exam from the Linux Foundation and CNCF.
  • Domain: one of the exam's five subject areas, each worth a fixed share of the score.
  • Control plane: the parts of Kubernetes that make decisions and store the cluster's state: the API server, scheduler, controller manager and etcd.
  • Worker node: a machine that runs your apps' pods.
  • kubelet: the agent on every node that starts and watches its pods.
  • Container runtime: the program that actually runs containers; here, containerd.
  • cgroups (control groups): the Linux feature that limits and measures a process's CPU and memory.
  • Client-side dry run: --dry-run=client, kubectl working out an object without contacting any cluster.
  • kubeconfig: the file, usually ~/.kube/config, that tells kubectl which clusters exist and how to log in to them.
  • Context: a kubectl setting that says which cluster, and which user, commands go to.

Go deeper