Part 2 Cumulative Quiz: Application Deployment
Time Limit: 25 minutes (simulating exam pressure)
Passing Score: 80% (8/10 questions)
This quiz tests your mastery of:
- Deployments and rolling updates/rollbacks
- Helm package manager
- Kustomize
- Deployment strategies (blue/green, canary)
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: Rolling Update Configuration
Section titled “Question 1: Rolling Update Configuration”[2 minutes]
Create a Deployment named webapp with 4 replicas using nginx:1.20 that:
- Uses
RollingUpdatestrategy - Has
maxSurge: 1 - Has
maxUnavailable: 0
Answer
cat << 'EOF' | k apply -f -apiVersion: apps/v1kind: Deploymentmetadata: name: webappspec: replicas: 4 strategy: type: RollingUpdate rollingUpdate: maxSurge: 1 maxUnavailable: 0 selector: matchLabels: app: webapp template: metadata: labels: app: webapp spec: containers: - name: nginx image: nginx:1.20EOFQuestion 2: Rollback
Section titled “Question 2: Rollback”[2 minutes]
A Deployment named api was updated but is failing. Roll it back to revision 2.
# Verify current statek rollout history deploy/apiAnswer
# Check historyk rollout history deploy/api
# Rollback to revision 2k rollout undo deploy/api --to-revision=2
# Verifyk rollout status deploy/apiQuestion 3: Helm Install with Values
Section titled “Question 3: Helm Install with Values”[2 minutes]
Install a chart from the bitnami repository:
- Release name:
my-nginx - Chart:
bitnami/nginx - Set
replicaCount=3 - Namespace:
web(create if doesn’t exist)
Answer
# Add repo if neededhelm repo add bitnami https://charts.bitnami.com/bitnamihelm repo update
# Install with valueshelm install my-nginx bitnami/nginx \ --set replicaCount=3 \ -n web --create-namespaceQuestion 4: Helm Rollback
Section titled “Question 4: Helm Rollback”[1 minute]
A Helm release my-app was upgraded and is now broken. Roll it back to the previous version.
Answer
# Check historyhelm history my-app
# Rollback to previoushelm rollback my-app
# Or to specific revisionhelm rollback my-app 1Question 5: Kustomize Basic
Section titled “Question 5: Kustomize Basic”[3 minutes]
Create a Kustomization that:
- Includes
deployment.yaml - Sets namespace to
production - Adds prefix
prod-to all names
Then apply it.
Answer
# Create kustomization.yamlcat << 'EOF' > kustomization.yamlapiVersion: kustomize.config.k8s.io/v1beta1kind: Kustomization
resources:- deployment.yaml
namespace: productionnamePrefix: prod-EOF
# Previewkubectl kustomize ./
# Applykubectl apply -k ./Question 6: Kustomize Image Override
Section titled “Question 6: Kustomize Image Override”[2 minutes]
Create a Kustomization that overrides the nginx image to use tag 1.22 instead of whatever is in the base manifests.
Answer
apiVersion: kustomize.config.k8s.io/v1beta1kind: Kustomization
resources:- deployment.yaml
images:- name: nginx newTag: "1.22"kubectl kustomize ./Question 7: Blue/Green Switch
Section titled “Question 7: Blue/Green Switch”[3 minutes]
You have two deployments:
app-bluewith labelversion: blueapp-greenwith labelversion: green
A Service app-svc currently points to blue. Switch it to green.
Answer
# Switch service selector to greenkubectl patch svc app-svc -p '{"spec":{"selector":{"version":"green"}}}'
# Verifykubectl get ep app-svckubectl describe svc app-svcQuestion 8: Canary Setup
Section titled “Question 8: Canary Setup”[3 minutes]
Set up a canary deployment where:
- Stable deployment
stable-apphas 9 replicas (90%) - Canary deployment
canary-apphas 1 replica (10%) - A single Service routes to both
Both deployments already exist with label app: myapp.
Answer
# Scale deployments for 10% canarykubectl scale deploy stable-app --replicas=9kubectl scale deploy canary-app --replicas=1
# Create service that matches both (using common label)kubectl expose deploy stable-app --name=myapp-svc --port=80 --selector=app=myapp
# Verify endpoints include pods from both deploymentskubectl get ep myapp-svcQuestion 9: Deployment Strategy
Section titled “Question 9: Deployment Strategy”[2 minutes]
A database application requires that only one version runs at a time (no concurrent versions). What Deployment strategy should you use, and how do you configure it?
Answer
Use the Recreate strategy:
apiVersion: apps/v1kind: Deploymentmetadata: name: databasespec: strategy: type: Recreate # ... rest of specThe Recreate strategy terminates all existing pods before creating new ones, ensuring no two versions run simultaneously.
Question 10: Helm Values
Section titled “Question 10: Helm Values”[2 minutes]
Get the currently applied values for a Helm release named production-app. Then upgrade it keeping existing values but adding service.type=LoadBalancer.
Answer
# Get current valueshelm get values production-app
# Upgrade keeping existing values, adding new onehelm upgrade production-app CHART_NAME \ --reuse-values \ --set service.type=LoadBalancerKey: --reuse-values keeps all existing custom values.
Scoring
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 2 modules |
Cleanup
Section titled “Cleanup”k delete deploy webapp api stable-app canary-app 2>/dev/nullk delete svc app-svc myapp-svc 2>/dev/nullhelm uninstall my-nginx -n web 2>/dev/nullhelm uninstall my-app 2>/dev/nullhelm uninstall production-app 2>/dev/nullk delete ns web 2>/dev/nullKey Takeaways
Section titled “Key Takeaways”If you scored less than 80%, review these areas:
- Missed Q1-2: Review Module 2.1 (Deployments) - rolling updates and rollbacks
- Missed Q3-4: Review Module 2.2 (Helm) - install, upgrade, rollback commands
- Missed Q5-6: Review Module 2.3 (Kustomize) - basic structure and transformations
- Missed Q7-8: Review Module 2.4 (Strategies) - blue/green and canary patterns
- Missed Q9-10: Review strategy types and Helm values management
Next Part
Section titled “Next Part”Part 3: Application Observability and Maintenance - Probes, logging, debugging, and API deprecations.