CKAD Pod Design and Deployments 1 — Questions and Answers
Question 1: Which kubectl command updates the image of a container named 'web' in a deployment named 'myapp' to 'nginx:1.19'?
- kubectl set image deployment/myapp web=nginx:1.19 (Correct answer)
- kubectl update image deployment/myapp web=nginx:1.19
- kubectl apply image deployment/myapp web=nginx:1.19
- kubectl replace image deployment/myapp web=nginx:1.19
Correct answer: kubectl set image deployment/myapp web=nginx:1.19
The 'kubectl set image deployment/<name> <container>=<image>' command updates a container's image in a deployment.
Question 2: What is the default update strategy for a Kubernetes Deployment?
- Recreate
- RollingUpdate (Correct answer)
- BlueGreen
- Canary
Correct answer: RollingUpdate
RollingUpdate is the default Deployment strategy, gradually replacing old pods with new ones to ensure zero downtime.
Question 3: Which field in a Deployment spec limits the number of unavailable pods during a rolling update?
- maxSurge
- maxUnavailable (Correct answer)
- minReadySeconds
- progressDeadlineSeconds
Correct answer: maxUnavailable
The 'maxUnavailable' field under 'rollingUpdate' controls how many pods can be unavailable at once during an update.
Question 4: How do you roll back a Deployment to the previous revision?
- kubectl rollback deployment/myapp
- kubectl undo deployment/myapp
- kubectl rollout undo deployment/myapp (Correct answer)
- kubectl revert deployment/myapp
Correct answer: kubectl rollout undo deployment/myapp
'kubectl rollout undo deployment/<name>' reverts a Deployment to its previous revision.
Question 5: Which label selector syntax matches pods with label 'env=prod' OR 'env=staging' using set-based requirements?
- env in (prod, staging) (Correct answer)
- env == prod || env == staging
- env: [prod, staging]
- env matches prod|staging
Correct answer: env in (prod, staging)
Set-based selectors use 'in' to match multiple values: 'env in (prod, staging)'.
Question 6: What does 'kubectl rollout status deployment/myapp' display?
- The current replica count
- The progress and completion status of the rollout (Correct answer)
- The pod logs during rollout
- The YAML manifest of the deployment
Correct answer: The progress and completion status of the rollout
'kubectl rollout status' watches and reports whether a rollout has completed successfully or is still in progress.
Which kubectl command updates the image of a container named 'web' in a deployment named 'myapp' to 'nginx:1.19'?