Part 1 Cumulative Quiz: Application Design and Build
Time Limit: 25 minutes (simulating exam pressure)
Passing Score: 80% (8/10 questions)
This quiz tests your mastery of:
- Container images
- Jobs and CronJobs
- Multi-container pods (sidecar, init, ambassador)
- Volumes (emptyDir, ConfigMap, Secret, PVC)
Instructions
Section titled “Instructions”- Try each question without looking at answers
- Time yourself—speed matters for CKAD
- Use only
kubectlandkubernetes.io/docs - Check answers after completing all questions
Questions
Section titled “Questions”Question 1: Image Pull Issue
Section titled “Question 1: Image Pull Issue”[2 minutes]
A pod is stuck in ImagePullBackOff:
k get pods# NAME READY STATUS RESTARTS AGE# broken 0/1 ImagePullBackOff 0 5mIdentify the issue and fix it. The pod should run nginx version 1.21.
Answer
# Diagnosek describe pod broken | grep -A5 Events# Look for: failed to pull image
# Check current imagek get pod broken -o jsonpath='{.spec.containers[0].image}'# Probably wrong tag or typo
# Fix (delete and recreate or patch)k delete pod brokenk run broken --image=nginx:1.21Question 2: Create a Job
Section titled “Question 2: Create a Job”[2 minutes]
Create a Job named backup-job that:
- Uses image
busybox - Runs command
echo "Backup completed at $(date)" - Has a backoff limit of 2
Answer
# Generate and modifyk create job backup-job --image=busybox --dry-run=client -o yaml -- sh -c 'echo "Backup completed at $(date)"' > job.yaml
# Add backoffLimit: 2 to spec, then apply# Or directly:cat << 'EOF' | k apply -f -apiVersion: batch/v1kind: Jobmetadata: name: backup-jobspec: backoffLimit: 2 template: spec: containers: - name: backup image: busybox command: ["sh", "-c", "echo Backup completed at $(date)"] restartPolicy: NeverEOFQuestion 3: CronJob Schedule
Section titled “Question 3: CronJob Schedule”[2 minutes]
Create a CronJob named cleanup that:
- Runs every 30 minutes
- Uses image
busybox - Echoes “Cleanup running”
- Has
concurrencyPolicy: Forbid
Answer
# Imperative then patchk create cronjob cleanup --image=busybox --schedule="*/30 * * * *" -- echo "Cleanup running"k patch cronjob cleanup -p '{"spec":{"concurrencyPolicy":"Forbid"}}'
# Or YAML:cat << 'EOF' | k apply -f -apiVersion: batch/v1kind: CronJobmetadata: name: cleanupspec: schedule: "*/30 * * * *" concurrencyPolicy: Forbid jobTemplate: spec: template: spec: containers: - name: cleanup image: busybox command: ["echo", "Cleanup running"] restartPolicy: OnFailureEOFQuestion 4: Multi-Container Pod
Section titled “Question 4: Multi-Container Pod”[3 minutes]
Create a pod named sidecar-pod with:
- Main container:
nginximage - Sidecar container:
busyboximage, runningtail -f /var/log/nginx/access.log - Both containers share a volume at
/var/log/nginx
Answer
apiVersion: v1kind: Podmetadata: name: sidecar-podspec: containers: - name: nginx image: nginx volumeMounts: - name: logs mountPath: /var/log/nginx - name: sidecar image: busybox command: ["tail", "-f", "/var/log/nginx/access.log"] volumeMounts: - name: logs mountPath: /var/log/nginx volumes: - name: logs emptyDir: {}k apply -f sidecar-pod.yamlQuestion 5: Init Container
Section titled “Question 5: Init Container”[3 minutes]
Create a pod named init-pod that:
- Has an init container that creates file
/work/ready.txtwith content “initialized” - Main container (nginx) mounts the same directory
Answer
apiVersion: v1kind: Podmetadata: name: init-podspec: initContainers: - name: init image: busybox command: ["sh", "-c", "echo initialized > /work/ready.txt"] volumeMounts: - name: workdir mountPath: /work containers: - name: nginx image: nginx volumeMounts: - name: workdir mountPath: /work volumes: - name: workdir emptyDir: {}Verify:
k exec init-pod -- cat /work/ready.txtQuestion 6: ConfigMap as Volume
Section titled “Question 6: ConfigMap as Volume”[2 minutes]
Create a ConfigMap named web-content with key index.html containing “Hello CKAD”.
Then create a pod named web-server that:
- Uses nginx image
- Mounts the ConfigMap at
/usr/share/nginx/html
Answer
# Create ConfigMapk create cm web-content --from-literal=index.html="Hello CKAD"
# Create podcat << 'EOF' | k apply -f -apiVersion: v1kind: Podmetadata: name: web-serverspec: containers: - name: nginx image: nginx volumeMounts: - name: html mountPath: /usr/share/nginx/html volumes: - name: html configMap: name: web-contentEOF
# Verifyk exec web-server -- curl localhostQuestion 7: Secret Volume
Section titled “Question 7: Secret Volume”[2 minutes]
Create a Secret named db-creds with:
username=adminpassword=secret123
Mount it read-only in a pod named secret-pod at /etc/db
Answer
# Create secretk create secret generic db-creds \ --from-literal=username=admin \ --from-literal=password=secret123
# Create podcat << 'EOF' | k apply -f -apiVersion: v1kind: Podmetadata: name: secret-podspec: containers: - name: app image: busybox command: ["sleep", "3600"] volumeMounts: - name: secrets mountPath: /etc/db readOnly: true volumes: - name: secrets secret: secretName: db-credsEOF
# Verifyk exec secret-pod -- cat /etc/db/passwordQuestion 8: Parallel Job
Section titled “Question 8: Parallel Job”[3 minutes]
Create a Job named parallel-job that:
- Runs 6 completions
- With parallelism of 2
- Uses busybox to echo “Processing”
Answer
apiVersion: batch/v1kind: Jobmetadata: name: parallel-jobspec: completions: 6 parallelism: 2 template: spec: containers: - name: worker image: busybox command: ["echo", "Processing"] restartPolicy: NeverVerify:
k get pods -l job-name=parallel-job -w# Should see 2 pods at a time, 6 totalQuestion 9: Fix Multi-Container Pod
Section titled “Question 9: Fix Multi-Container Pod”[3 minutes]
The following pod won’t start. Identify and fix the issue:
apiVersion: v1kind: Podmetadata: name: broken-multispec: initContainers: - name: init image: busybox command: ["sleep", "infinity"] # Problem! containers: - name: main image: nginxAnswer
Issue: The init container runs sleep infinity and never exits. Init containers must complete (exit 0) for main containers to start.
Fix: Change the init container command to something that completes:
initContainers:- name: init image: busybox command: ["echo", "Init done"]Question 10: PVC and Pod
Section titled “Question 10: PVC and Pod”[3 minutes]
Create a PVC named data-pvc requesting 100Mi storage.
Then create a pod named storage-pod that:
- Uses nginx image
- Mounts the PVC at
/data
Write a file to /data/test.txt to verify persistence.
Answer
# Create PVCcat << 'EOF' | k apply -f -apiVersion: v1kind: PersistentVolumeClaimmetadata: name: data-pvcspec: accessModes: ["ReadWriteOnce"] resources: requests: storage: 100MiEOF
# Create podcat << 'EOF' | k apply -f -apiVersion: v1kind: Podmetadata: name: storage-podspec: containers: - name: nginx image: nginx volumeMounts: - name: storage mountPath: /data volumes: - name: storage persistentVolumeClaim: claimName: data-pvcEOF
# Verifyk exec storage-pod -- sh -c "echo 'persistent' > /data/test.txt"k exec storage-pod -- cat /data/test.txtScoring
Section titled “Scoring”| Questions Correct | Score | Status |
|---|---|---|
| 10/10 | 100% | Excellent - Ready for exam |
| 8-9/10 | 80-90% | Good - Minor review needed |
| 6-7/10 | 60-70% | Review weak areas |
| <6/10 | <60% | Revisit Part 1 modules |
Cleanup
Section titled “Cleanup”k delete pod broken sidecar-pod init-pod web-server secret-pod storage-pod broken-multi 2>/dev/nullk delete job backup-job parallel-job 2>/dev/nullk delete cronjob cleanup 2>/dev/nullk delete cm web-content 2>/dev/nullk delete secret db-creds 2>/dev/nullk delete pvc data-pvc 2>/dev/nullNext Part
Section titled “Next Part”Part 2: Application Deployment - Deployments, Helm, Kustomize, and deployment strategies.