Skip to content
CNPE · Chapter 19 of 22 Day 17: Competition – the broken platform

Day 17: Competition – the broken platform

Goal: Find and fix six faults across the platform – without knowing where they are. Each one earns points, the clock is running · Duration: approx. 60 min · Prerequisite: Day 16

Briefing

  • During the night a colleague “changed a few things”. The teams report:
    • Team Rot: “Our catalogue no longer comes from Git, and new pods don’t start.”
    • Team Blue: “The customer gets 403, and our metrics are missing from the dashboard.”
    • Team Green: “staging is no longer being updated.”
    • Team Gelb: “wartet is stuck.”
  • Six faults, 10 points each. Full points only if the cause is fixed – not if the symptom disappears (e.g. switching off the policy instead of correcting the image: 0 points).
  • Time: 45 minutes. Playing alone: set a timer. In pairs: one sets up the faults, the other searches.

Preparation (referee)

Whoever searches does not read this section. The referee runs the commands and waits two minutes:

# on cp1 – referee
kubectl -n argocd patch application team-rot-katalog --type=merge -p '{"spec":{"source":{"path":"apps/team-rot/katlog"}}}'
kubectl cordon worker1
kubectl taint node worker2 wartung=ja:NoSchedule
kubectl -n team-blue patch servicemonitor podinfo --type=json -p '[{"op":"replace","path":"/spec/endpoints/0/port","value":"metrics"}]'
kubectl -n team-blue patch meshtlsauthentication nur-kunde --type=json -p '[{"op":"replace","path":"/spec/identityRefs/0/name","value":"kunden"}]'
kubectl -n team-rot patch hpa katalog -p '{"spec":{"minReplicas":20,"maxReplicas":25}}'
cd ~/cnpe/plattform && git pull -q
yq -i '.images[0].newTag = "820f70f" | .images[0].digest = "sha256:6de37ffb75629d3242a8e4b3991f150631401c6055c96eec4058ebe25e6bedf6"' \
  apps/team-green/shop/overlays/staging/kustomization.yaml
git commit -qam 'staging: zurück auf 820f70f' && git push -q
kubectl -n team-gelb delete pod -l app=wartet --now
sleep 120

The unsigned image shop:820f70f in your lab probably does not have the digest 6de37ff… – use the one Kyverno reported for unsigniert on Day 14.

Situation overview – the first look

Before you chase individual reports: five commands that show the whole platform.

# on cp1
k get nodes
argocd app list -o wide | awk '{print $1, $5, $6, $7}' | column -t
k get pods -A --field-selector=status.phase=Pending --no-headers | wc -l
k -n team-blue logs deploy/kunde -c curl --tail=1
curl -s 'http://172.16.0.126:30090/api/v1/targets?state=active' | jq -r '[.data.activeTargets[] | select(.labels.job=="podinfo")] | length'

Expected (this is how it looks after the sabotage):

NAME      STATUS                     ROLES           AGE    VERSION
cp1       Ready                      control-plane   3h6m   v1.37.3
worker1   Ready,SchedulingDisabled   <none>          3h4m   v1.37.3
worker2   Ready                      <none>          3h4m   v1.37.3
NAME                            STATUS     HEALTH   SYNCPOLICY
argocd/team-green-shop-prod     Synced     Healthy  Auto-Prune
argocd/team-green-shop-staging  OutOfSync  Healthy  Auto-Prune
argocd/team-rot-katalog         Unknown    Healthy  Auto-Prune
6
403
0

From here on you are on your own. The resolution follows below – read it only after the time is up.


Resolution

Fault 1: Argo CD cannot find the path (GitOps)

# on cp1
k -n argocd get application team-rot-katalog -o jsonpath='{.status.conditions[0].type}: {.status.conditions[0].message}{"\n"}'

Expected:

ComparisonError: Failed to load target state: failed to generate manifest for source 1 of 1: rpc error: code = Unknown desc = apps/team-rot/katlog: app path does not exist

katlog instead of katalog. With Argo CD, status Unknown almost always means: it could not evaluate Git at all.

# on cp1
k -n argocd patch application team-rot-katalog --type=merge -p '{"spec":{"source":{"path":"apps/team-rot/katalog"}}}'

Even better: the Application itself belongs in Git (app of apps) – then the change would have been a commit with an author.

Fault 2: No node accepts pods (platform architecture)

# on cp1
k -n team-gelb get events --field-selector reason=FailedScheduling -o custom-columns=MSG:.message --no-headers | tail -1
k describe node worker2 | grep Taints

Expected:

0/3 nodes are available: 1 node(s) were unschedulable, 2 node(s) had untolerated taint(s). preemption: 0/3 nodes are available: 3 Preemption is not helpful for scheduling.
Taints:             wartung=ja:NoSchedule

worker1 cordoned (cordon), worker2 with a taint, cp1 anyway – no node is left.

# on cp1
k uncordon worker1
# Remove the taint: the same command with "-" at the end
k taint node worker2 wartung=ja:NoSchedule-

Fault 3: Metrics are missing (observability)

# on cp1
k -n team-blue get servicemonitor podinfo -o jsonpath='{.spec.endpoints[0].port}{"\n"}'
k -n team-blue get svc podinfo -o jsonpath='{.spec.ports[*].name}{"\n"}'

Expected:

metrics
http

The ServiceMonitor refers to a port name that the Service does not have. Prometheus then does not report “down” – the target simply does not exist. That is why the situation overview counted 0 targets.

# on cp1
k -n team-blue patch servicemonitor podinfo --type=json -p '[{"op":"replace","path":"/spec/endpoints/0/port","value":"http"}]'

Fault 4: The customer gets 403 (security)

# on cp1
k -n team-blue get meshtlsauthentication nur-kunde -o jsonpath='{.spec.identityRefs[0].name}{"\n"}'
k -n team-blue get sa -o name | grep kund

Expected:

kunden
serviceaccount/kunde

The rule allows a ServiceAccount that does not exist. The 403 comes from the proxy, not from podinfo – that is why there is nothing in podinfo’s logs.

# on cp1
k -n team-blue patch meshtlsauthentication nur-kunde --type=json -p '[{"op":"replace","path":"/spec/identityRefs/0/name","value":"kunde"}]'

Fault 5: The quota fills up (operations)

# on cp1
k -n team-rot get hpa katalog
k -n team-rot get events --field-selector reason=FailedCreate -o custom-columns=MSG:.message --no-headers | tail -1

Expected:

NAME      REFERENCE            TARGETS       MINPODS   MAXPODS   REPLICAS   AGE
katalog   Deployment/katalog   cpu: 0%/60%   20        25        20         7m1s
(combined from similar events): Error creating: pods "katalog-65fb955b88-xbqn6" is forbidden: exceeded quota: team-quota, requested: limits.cpu=500m, used: limits.cpu=4, limited: limits.cpu=4

0 % load, but 20 replicas wanted: someone raised minReplicas. The quota limits the damage – that is exactly what it is there for.

# on cp1
k -n team-rot patch hpa katalog -p '{"spec":{"minReplicas":2,"maxReplicas":5}}'

Fault 6: staging stands still (supply chain)

# on cp1
argocd app get team-green-shop-staging | grep Deployment | cut -c1-200

Expected (abridged):

apps   Deployment  team-green-staging  shop   OutOfSync  Healthy   error when patching "/dev/shm/3339584083": admission webhook "ivpol.validate.kyverno.svc-fail" denied the request: Policy signierte-images failed: Images aus der Pla…

A commit reset staging to the unsigned 820f70f. Kyverno rejects it, the running version stays – the system protects itself. The cause lies in Git:

# on cp1
cd ~/cnpe/plattform && git pull -q
git log --oneline -1
git revert --no-edit HEAD && git push -q
# end the hanging sync (Day 4)
argocd app terminate-op team-green-shop-staging

Expected (abridged):

… staging: zurück auf 820f70f
[main ca04792] Revert "staging: zurück auf 820f70f"
Application 'team-green-shop-staging' operation terminating

Checkpoint – the scoring

After waiting two minutes, each command earns 10 points if it shows what is expected:

# on cp1
sleep 90
# 1: all Applications in sync
argocd app list -o wide | awk 'NR>1 {print $5}' | sort -u
# 2: no node cordoned, no wartung taint, nothing Pending
k get nodes --no-headers | grep -c SchedulingDisabled; k get pods -A --field-selector=status.phase=Pending --no-headers 2>/dev/null | wc -l
# 3: both podinfo targets up
curl -s 'http://172.16.0.126:30090/api/v1/targets?state=active' | jq -r '[.data.activeTargets[] | select(.labels.job=="podinfo" and .health=="up")] | length'
# 4: customer gets 200
k -n team-blue logs deploy/kunde -c curl --tail=1
# 5: katalog back at 2
k -n team-rot get hpa katalog -o jsonpath='{.status.currentReplicas}{"\n"}'
# 6: staging on a signed digest
argocd app get team-green-shop-staging --refresh | grep 'Sync Status'

Expected:

Synced
0
0
2
200
2
Sync Status:        Synced to main (ca04792)
points Assessment
60 in under 30 min exam-ready
50–60 in 45 min almost – practise the slowest fault once more
under 50 internalise the situation overview commands; repeat the days of the faults you missed

Interview Note

  • How do you approach an unknown fault in a platform? First the situation overview (nodes, GitOps, Pending, alerts), then from the team’s report to the cause – and after the fix, check whether the symptom has really gone.
  • Why not simply switch off the policy when it blocks? It blocks for good reason; the cause was a commit. Removing protection mechanisms shifts the problem into production.

Enterprise Note

  • With Git as the single source (Applications, HPA, ServiceMonitor, Linkerd rules in the repo), each of the six changes would have been a visible commit – with review, author and git revert.
  • The API server’s audit logs show who ran cordon, taint and patch.
  • Run chaos exercises like this one regularly in the team: they reveal gaps in monitoring (fault 3 did not trigger an alert!) and in the runbooks.

Contents

More