KCNA ยท Kubernetes core concepts
ReplicaSets and Deployments
Replica management, Deployment rollout, rolling update and rollback, scaling.
Key points
- A ReplicaSet keeps a stated number of identical Pods running.
- A Deployment manages ReplicaSets for you: changing the Pod template creates a new ReplicaSet and performs a rolling update, old ReplicaSets are kept for rollback, and changing replicas only scales.
- Use kubectl rollout undo to go back and kubectl scale to change the count.
Source: https://kubernetes.io/docs/concepts/workloads/controllers/deployment/
Practice questions
Which object does a Deployment create and own to keep the desired number of Pods running?
- StatefulSet
- DaemonSet
- ReplicaSet
- Job
Show answer
Answer: C. ReplicaSet
A Deployment manages ReplicaSets and each ReplicaSet maintains its Pods. The other controllers solve different workload types.
Which edits to a Deployment trigger a new rollout?
- Changing the container image in the Pod template
- Changing .spec.replicas
- Adding an environment variable in the Pod template
- Changing a container's command in the Pod template
- Running kubectl get on it
Show answer
Answer: A. Changing the container image in the Pod template, C. Adding an environment variable in the Pod template, D. Changing a container's command in the Pod template
A rollout starts when the Pod template changes. Replica changes only scale and reading does nothing.
Changing the replicas count of a Deployment creates a new ReplicaSet revision.
Show answer
Answer: False
Scaling changes the size of the current ReplicaSet. A new revision comes from a Pod template change.
Practice 8 questions on this topic in Bitzu
Short lessons, instant explanations and spaced review of what you get wrong. Free on iOS and Android.
