📡 You're offline — showing cached content
New version available!
Quick Access
Tutorials Kubernetes Deployments

Deployments

6 min read Quiz at the end
Deployments manage replica count, rolling updates, and rollbacks for stateless applications.

Kubernetes Deployments

# deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: myapp
spec:
  replicas: 3
  selector:
    matchLabels:
      app: myapp
  template:
    metadata:
      labels:
        app: myapp
    spec:
      containers:
        - name: myapp
          image: myapp:1.0
          ports:
            - containerPort: 3000

kubectl apply -f deployment.yaml
kubectl get deployments
kubectl rollout status deployment/myapp
kubectl scale deployment myapp --replicas=5
kubectl set image deployment/myapp myapp=myapp:2.0
kubectl rollout undo deployment/myapp
Topic Quiz · 2 questions

Test your understanding before moving on

1. What does kubectl rollout undo deployment/myapp do?
💡 rollout undo reverts to the previous deployment revision — useful after a bad update.
2. What does the selector in a Deployment do?
💡 The selector matchLabels must match the Pod template labels to link the Deployment to its Pods.