☸️ Kubernetes YAML Bug-Hunt

Find the errors in the 10 YAML snippets below. Click "Show Answer" to verify.

Challenge 1: The Indentation Trap Beginner
apiVersion: v1 kind: Pod metadata: name: web-pod spec: # Something is wrong here... containers: - name: nginx image: nginx:latest
The Error: Indentation. The spec key has a leading space. It must align perfectly with metadata.
Challenge 2: The Missing List Beginner
spec: containers: name: alpine # Where is the dash? image: alpine
The Error: containers is an array. You need a - before name.
Challenge 3: API Group Confusion Intermediate
apiVersion: v1 kind: Deployment metadata: name: my-deploy
The Error: Deployments belong to apps/v1, not v1.
Challenge 4: The Label Mismatch Intermediate
# Service Selector selector: app: frontend --- # Pod Label labels: app: web-ui
The Error: The Service is looking for 'frontend', but the Pod is 'web-ui'. They won't connect!
Challenge 5: Duplicate Keys Intermediate
labels: env: prod labels: team: ops
The Error: You cannot have the same key (labels) twice in the same block.
Challenge 6: Invalid CPU Units Advanced
resources: requests: cpu: "500mb"
The Error: CPU is measured in cores or millicores (500m), not megabytes (mb).
Challenge 7: Selector Immutability Advanced
selector: matchLabels: app: nginx template: metadata: labels: app: webserver
The Error: The Deployment selector MUST match the labels in the Pod template.
Challenge 8: Volume Reference Advanced
volumeMounts: - name: data volumes: - name: config
The Error: The volumeMounts name must match an existing name in the volumes list.
Challenge 9: Port Name Duplicates Expert
ports: - port: 80 name: http - port: 443 name: http
The Error: Port names within a Service must be unique. You can't have two named 'http'.
Challenge 10: Probe Logic Expert
livenessProbe: periodSeconds: 10 timeoutSeconds: 15
The Error: Timeout cannot be greater than the period. You can't wait 15s for a check that happens every 10s.