Mock exam
Fifteen hands-on tasks, 120 minutes, 100 points, weighted just like the official blueprint (15/25/25/20/15). You'll need make full running on the main cluster (no mesh or portal needed), plus the section 2.2 ApplicationSet applied (kubectl apply -f examples/argocd-appset.yaml) and the demo-app Dockerfile from section 2.4 pushed to Gitea. Both are already part of the regular curriculum path.
The clock
Ground rules: start the clock, stay out of the curriculum pages and the answers below, and wait until you're done to run the grading commands. Official docs and --help are fair game, just like on exam day. If the grading command can't observe it, it doesn't count; the real exam works the exact same way. Aim for 70+ overall with zero domains at 0. Hit a wall on a task? Note the time, skip it, and come back later.
Tasks
Create namespace team-x with the label pod-security.kubernetes.io/enforce=baseline. Inside it, create ResourceQuota mock-quota (requests.cpu: 1, requests.memory: 2Gi, pods: 5) and LimitRange mock-limits so containers default to 100m/128Mi requests and 200m/256Mi limits.
In team-x, create Deployment web using image ghcr.io/nginxinc/nginx-unprivileged:1.27-alpine on port 8080 with 4 replicas. Give each container explicit requests of 25m CPU and 32Mi memory, and spread the pods evenly across zones using a topologySpreadConstraint (maxSkew: 1, whenUnsatisfiable: DoNotSchedule on topology.kubernetes.io/zone). All 4 pods must reach Ready.
Using git only (no manual kubectl edits): update the staging overlay of demo-app to 2 replicas and let Argo CD roll it out. The live Deployment is staging-demo in team-a.
Create a Flux Kustomization named mock-demo backed by the existing GitRepository/platform, deploying path ./demo-app/base into a new namespace mock-flux with pruning enabled and a 1m interval. Both replicas must reach Ready.
Apply examples/rollouts/canary.yaml and wait until Rollout demo in team-a is Healthy. Trigger a canary update to image tag 1.26-alpine, then abort it mid-rollout (metric analysis might beat you to it since the demo app doesn't expose http_requests_total, so run the abort command yourself anyway). The Rollout must finish aborted with stable traffic still served by 1.27-alpine.
Create a namespaced CRD mockapps.mock.lab (kind MockApp, plural mockapps) whose spec requires a string field tier restricted to dev or prod, and exposes it in a printer column named TIER. Create an instance named one (tier: dev) in default. Trying to create a MockApp with tier: staging must be rejected by the API server.
Using the lab's existing AppEnvironment platform API, provision an environment named team-y-dev in default for team team-y with cpuQuota: "3" and memoryQuota: 6Gi, and wait until it finishes reconciling.
Create and run an Argo Workflow in default (any name or generateName is fine) that creates ConfigMap mock-result in default containing result=done. Run it under a ServiceAccount granted only the exact permissions it needs. The workflow must reach Succeeded.
Deploy quay.io/brancz/prometheus-example-app:v0.5.0 in default as a Deployment and Service both named mock-metrics (port 8080), then wire up a ServiceMonitor so Prometheus scrapes it. The target must report state up.
Create a PrometheusRule defining an alert named MockDown that fires (after 1m) whenever mock-metrics has zero healthy scrape targets. Prove it actually works by scaling mock-metrics to 0 and waiting for the alert to show up in Alertmanager.
Run make break. Track down the root cause, write a one-line diagnosis to /tmp/mock-diagnosis.txt before peeking at the answer, and repair the cluster by hand (no make break-fix). Count this only if make break-answer matches what you wrote and the symptom is genuinely gone.
Create ServiceAccount auditor in team-b with permission to get and list pods and deployments in team-b, and nothing else (no write verbs, no access to other namespaces).
Create namespace policy-test, then configure the installed policy engine to reject any new pod in that namespace whose containers don't declare CPU or memory requests. (Switch it back after grading. If your first instinct was to test this inside team-b, stop and work out why team-b can never trigger a rejection before peeking at the answer.)
Pull every successful delete performed today by the admin user out of the API server audit logs and save them to /tmp/mock-audit.json, one JSON event per line, each keeping verb, user.username, and objectRef.
Generate a cosign key pair at /tmp/mock-cosign.key and /tmp/mock-cosign.pub (the grader reads the public key from that path), sign localhost:5001/demo:v1 by digest, and verify the signature against the registry. Both steps must succeed.
Grading
Run the whole block below; every command prints the exact signal that earns the points. Running make grade from the repo executes this block verbatim straight out of this HTML file, so the exam paper and grader never drift apart.
# 1
kubectl get ns team-x -o jsonpath='{.metadata.labels.pod-security\.kubernetes\.io/enforce}{"\n"}' # baseline
kubectl -n team-x get resourcequota mock-quota -o jsonpath='{.spec.hard}{"\n"}' # cpu 1, mem 2Gi, pods 5
kubectl -n team-x run graded --image=busybox:1.37 --restart=Never --dry-run=client -o yaml -- sleep 30 | kubectl apply -f - ; sleep 5
kubectl -n team-x get pod graded -o jsonpath='{.spec.containers[0].resources}{"\n"}' # 100m/128Mi defaults injected
# 2
kubectl -n team-x get deploy web -o jsonpath='{.status.readyReplicas}{"\n"}' # 4
kubectl -n team-x get pods -l app=web -o custom-columns=NODE:.spec.nodeName --no-headers | sort | uniq -c # 2+2 across zone nodes
# 3
kubectl -n team-a get deploy staging-demo -o jsonpath='{.spec.replicas}{"\n"}' # 2
kubectl -n argocd get app demo-staging -o jsonpath='{.status.sync.status}{"\n"}' # Synced (git did it, not kubectl)
# 4
flux get kustomization mock-demo # Ready True
kubectl -n mock-flux get deploy demo -o jsonpath='{.status.readyReplicas}{"\n"}' # 2
# 5
kubectl -n team-a get rollout demo -o jsonpath='{.status.abort}{"\n"}' # true
kubectl -n team-a get rollout demo -o jsonpath='{.spec.template.spec.containers[0].image}{"\n"}' # ...1.26-alpine requested
kubectl argo rollouts status demo -n team-a --timeout 10s 2>&1 | head -1 # Degraded/aborted, stable serving old
# 6
kubectl get crd mockapps.mock.lab -o jsonpath='{.status.conditions[?(@.type=="Established")].status}{"\n"}' # True
kubectl get mockapp one # TIER column shows dev
kubectl apply -f <(kubectl get mockapp one -o json | jq '.metadata.name="bad" | .spec.tier="staging"') 2>&1 | grep -i unsupported # rejection
# 7
kubectl get appenvironment team-y-dev -o jsonpath='{.status.conditions[?(@.type=="Ready")].status}{"\n"}' # True
kubectl -n team-y get resourcequota tenant-quota -o jsonpath='{.spec.hard}{"\n"}' # cpu 3, memory 6Gi
# 8
kubectl get workflow -o jsonpath='{.items[?(@.status.phase=="Succeeded")].metadata.name}{"\n"}' # your workflow
kubectl get cm mock-result -o jsonpath='{.data.result}{"\n"}' # done
# 9
kubectl -n monitoring port-forward svc/prometheus-kube-prometheus-prometheus 19090:9090 & sleep 3
curl -sG 'http://localhost:19090/api/v1/query' --data-urlencode 'query=max_over_time(up{job="mock-metrics"}[2h])' | jq -r '.data.result[0].value[1]' # 1 (holds even after task 10 scaled it to 0)
# 10 (after scaling to 0 and waiting out the for:)
kubectl -n monitoring port-forward svc/prometheus-kube-prometheus-alertmanager 19093:9093 & sleep 3
curl -s 'http://localhost:19093/api/v2/alerts?filter=alertname%3D%22MockDown%22' | jq -r '.[0].status.state' # active
# 11
cat /tmp/mock-diagnosis.txt && make break-answer # must agree; then show the symptom gone
# 12
kubectl auth can-i list pods --as=system:serviceaccount:team-b:auditor -n team-b # yes
kubectl auth can-i create pods --as=system:serviceaccount:team-b:auditor -n team-b # no
kubectl auth can-i list pods --as=system:serviceaccount:team-b:auditor -n team-a # no
# 13
kubectl -n policy-test run graded-naked --image=busybox:1.37 --restart=Never -- sleep 5 2>&1 | grep -ci 'request' # >=1 (rejected)
# 14
jq -e 'select(.verb=="delete") | .user.username, .objectRef.resource' /tmp/mock-audit.json | head # parses, right fields
# 15
cosign verify --key /tmp/mock-cosign.pub --allow-http-registry localhost:5001/demo@$(skopeo inspect --tls-verify=false docker://localhost:5001/demo:v1 | jq -r .Digest) 2>&1 | grep -c 'signatures were verified' # 1Answers
Just the key moves here; each points back to the curriculum section where we unpack the full pattern.
1 · namespace, quota, limit range
Three objects straight from section 1.4. The grader checks whether the LimitRange actually injects defaults onto a bare pod, so make sure both default: and defaultRequest: are set.
2 · spread deployment
You must set explicit requests here; otherwise team-x's LimitRange (100m) pushes 4 replicas over quota, while 25m×4 fits comfortably under 1 CPU. Use the zone-spread pattern from section 1.2. If pods sit Pending, check the scheduling or quota events.
3 · change through git
Clone the platform repo with credentials (http://lab:$GITEA_PASS@gitea.lab:3000/lab/platform.git; anonymous pushes are rejected), update replicas in demo-app/overlays/staging/kustomization.yaml, push, and either wait for the ApplicationSet's automated sync or run argocd app sync demo-staging to skip the poll window. Covered in section 2.2.
4 · Flux Kustomization
Create the namespace, then run flux create kustomization mock-demo --source=GitRepository/platform --path=./demo-app/base --target-namespace=mock-flux --prune=true --interval=1m. Covered in section 2.3.
5 · canary and abort
Trigger the rollout with kubectl argo rollouts set image demo web=ghcr.io/nginxinc/nginx-unprivileged:1.26-alpine -n team-a, then abort during the pause with kubectl argo rollouts abort demo -n team-a. An aborted Rollout leaves the new tag in spec, keeps the stable ReplicaSet serving the old version, and flips status.abort: true. Covered in section 2.5.
6 · CRD with validation
Start from section 3.2's CRD skeleton, add enum: [dev, prod] to spec.tier, and wire up an additionalPrinterColumns entry (name: TIER, jsonPath .spec.tier). The API server's enum validator handles the rejection message automatically.
7 · AppEnvironment
Copy examples/crossplane/xr.yaml, update the name, team, and quota values, apply it, and watch kubectl get appenvironment -w until it hits Ready. If it hangs, run crossplane resource trace (section 3.5).
8 · workflow with RBAC
Follow section 3.4 with a single resource template (action: create with the ConfigMap manifest inline). The ServiceAccount needs create on configmaps in default plus create,patch on workflowtaskresults.argoproj.io, which is the executor's reporting channel, and skipping it makes an otherwise flawless workflow fail. Bind via Role/RoleBinding and reference it in spec.serviceAccountName.
9 · scrape a new target
Create a Deployment and Service with a named port, then point a ServiceMonitor at the Service's labels using that exact port name. Our lab's Prometheus selects all monitors (selector {}); on a stock install you'd also need the Helm release label, so always inspect the Prometheus selector first. Section 4.1's second exercise walks through this end to end. Note that grading queries max_over_time(up{job="mock-metrics"}[2h]) instead of live up because task 10 has you scale the app down to zero: as long as Prometheus scraped it healthy within the past two hours, you keep the points (just don't take a two-hour coffee break before grading).
10 · alert that fires
Use expr: absent(up{job="mock-metrics"} == 1) (or count(up{...}==1) == 0 with care around or vector) and for: 1m. Scale to 0 and give it ~2–3 minutes for scrape evaluation, the for: window, and group_wait. Covered in section 4.2, and the rule selector story mirrors task 9.
11 · diagnose the fault
Run the section 4.6 playbook: scope the blast radius, check the timeline, and descend layer by layer. Aim to solve it under 7 minutes.
12 · read-only service account
Create a Role (get/list on pods and deployments) and a RoleBinding to the ServiceAccount, both strictly inside team-b. If you used a ClusterRoleBinding, the third grading check catches it immediately. Covered in section 5.1.
13 · enforce the policy
Run kubectl patch validatingpolicy require-resource-requests --type=merge -p '{"spec":{"validationActions":["Deny"]}}' since the policy ships in Audit mode. Why policy-test instead of team-b? Because every tenant namespace has a LimitRange, and LimitRanger mutates default requests onto pods before validation runs, so team-b can literally never produce a rejection. Section 5.2 unpacks this exact admission-order trap. Flip it back to ["Audit"] when you're done.
14 · audit extraction
Run docker exec cnpe-control-plane sh -c 'cat /var/log/kubernetes/audit*.log' | jq -c --arg d "$(date -u +%F)" 'select(.verb=="delete" and .responseStatus.code<300 and (.user.username|test("admin")) and (.requestReceivedTimestamp|startswith($d)))' > /tmp/mock-audit.json (section 5.4). Make sure you read all rotated files, not just audit.log: the API server rotates at 100MB, which a busy lab fills in roughly an hour, so an early delete has usually rolled over by grading time. The $d filter keeps "today" accurate across those rotations.
15 · sign and verify
Same flow as section 5.6, just pointing the key pair at the graded path: cosign generate-key-pair --output-key-prefix /tmp/mock-cosign, sign by digest with --allow-http-registry -y, and verify using the public key. If demo:v1 isn't in your registry yet, run the section 2.4 pipeline (it pushes as kind-registry:5000/demo:v1, which the host sees at localhost:5001/demo:v1).
After scoring
Track your score per domain, not just the total, because a zero in one domain can sink you even when your overall average looks comfortable. Re-drill your weakest domain's lessons, wait two days, and take Mock exam 2 on a clean lab (make down && make full). Fifteen brand-new tasks you haven't half-memorized will tell you far more about exam readiness than re-running paper 1.
Clean up before rebuilding, and always delete parents first: remove the Kustomization and AppEnvironments rather than the namespaces they manage, or their controllers will happily recreate what you just deleted. Do the git revert first too: task 3's replica change lives in Gitea, which survives make down (only make nuke wipes it), so leaving it at 2 replicas quietly pre-passes that task on future runs.
# task 3 lives in git: put staging back to 1 replica or every future paper inherits the answer
source lab.env # for GITEA_PASS
tmp=$(mktemp -d) && git clone -q "http://lab:${GITEA_PASS}@gitea.lab:3000/lab/platform.git" "$tmp" && \
sed -i -E 's/(name: demo, count:) *[0-9]+/\1 1/' "$tmp/demo-app/overlays/staging/kustomization.yaml" && \
git -C "$tmp" commit -aqm "staging back to 1 replica" && git -C "$tmp" push -q; rm -rf "$tmp"
# controllers first, or they rebuild what you are deleting
flux delete kustomization mock-demo --silent # prune takes the mock-flux deployment with it
kubectl delete appenvironment team-y-dev --ignore-not-found # Crossplane deletes team-y for you
kubectl delete appenvironment drill-env --ignore-not-found # if task 11 dealt you the apis drill
kubectl -n team-a delete rollout demo --ignore-not-found
kubectl -n team-a delete analysistemplate success-rate --ignore-not-found
kubectl delete crd mockapps.mock.lab --ignore-not-found # instances go with it
# names below task text never fixed are yours; --ignore-not-found keeps the sweep going
kubectl delete wf --all # task 8's name was yours; this also clears 3.4's practice runs in default
kubectl delete sa mock-wf --ignore-not-found; kubectl delete role,rolebinding mock-wf --ignore-not-found
kubectl delete cm mock-result --ignore-not-found
kubectl delete deploy,svc,servicemonitor mock-metrics --ignore-not-found
# 4.2's version puts the rule in monitoring; kubectl get prometheusrule -A if you named it something else
kubectl delete prometheusrule mock-down --ignore-not-found
kubectl -n monitoring delete prometheusrule mock-down --ignore-not-found
kubectl -n team-b delete sa auditor --ignore-not-found; kubectl -n team-b delete role,rolebinding auditor --ignore-not-found
kubectl patch validatingpolicy require-resource-requests --type=merge -p '{"spec":{"validationActions":["Audit"]}}'
kubectl delete ns team-x mock-flux policy-test --ignore-not-found
# the signature on demo:v1 stays: the lab registry refuses manifest deletes (cosign clean
# reports UNSUPPORTED), and it is inert anyway: task 15 verifies against a fresh key
rm -f /tmp/mock-cosign.key /tmp/mock-cosign.pub /tmp/mock-diagnosis.txt /tmp/mock-audit.json
pkill -f 'port-forward.*1909[03]' # the two grading port-forwards, if you pasted by hand