Deployment, ReplicaSet, & ReplicationController
This section covers three core Kubernetes workload management concepts, Deployment, ReplicaSet, and ReplicationController.
What is a Deployment?
Deployment → manages ReplicaSets → manages PodsKey Responsibilities of a Deployment
Deployment YAML Example
apiVersion: apps/v1 # API group for Deployments
kind: Deployment # Resource type
metadata:
name: nginx-deployment # Deployment name
labels:
app: nginx
spec:
replicas: 3 # Desired number of Pods
selector: # Defines which Pods this Deployment manages
matchLabels:
app: nginx
strategy: # Defines how updates are rolled out
type: RollingUpdate # RollingUpdate (default) or Recreate
rollingUpdate:
maxUnavailable: 1 # How many Pods can be unavailable during update
maxSurge: 1 # How many extra Pods can be created temporarily
template: # Pod template used to create Pods
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx:1.24 # Container image
ports:
- containerPort: 80
resources:
requests:
cpu: "100m" # Minimum guaranteed CPU
memory: "128Mi" # Minimum guaranteed memory
limits:
cpu: "500m" # Max CPU allowed
memory: "256Mi" # Max memory allowedBreaking Down the YAML
Creating and Viewing a Deployment
Updating a Deployment
Scaling a Deployment
Deleting a Deployment
Why Use Deployments
What is a ReplicaSet?
How ReplicaSets Work
ReplicaSet YAML Example
Breaking Down the YAML
Practical Example
Set-Based Label Selectors
When to Use ReplicaSet Directly
What is a ReplicationController?
ReplicationController Responsibilities
ReplicationController YAML Example
Explanation
Commands
How These Three Relate ?
Last updated