0
0
Kubernetesdevops~5 mins

Progressive delivery concept in Kubernetes - Commands & Configuration

Choose your learning style9 modes available
Introduction
Progressive delivery helps release new software versions slowly and safely. It reduces risks by exposing changes to a small group first, then gradually to everyone.
When you want to test a new app version with a small group of users before full release
When you want to reduce downtime or errors during software updates
When you want to monitor new features and roll back quickly if problems appear
When you want to deploy updates multiple times a day without affecting all users
When you want to gather feedback from real users on new changes before full rollout
Config File - deployment.yaml
deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: my-app
  labels:
    app: my-app
spec:
  replicas: 5
  selector:
    matchLabels:
      app: my-app
  strategy:
    type: RollingUpdate
    rollingUpdate:
      maxSurge: 1
      maxUnavailable: 1
  template:
    metadata:
      labels:
        app: my-app
    spec:
      containers:
      - name: my-app-container
        image: my-app:1.1
        ports:
        - containerPort: 80

This file defines a Kubernetes Deployment for the app.

replicas: number of app copies running.

strategy: RollingUpdate means new version replaces old gradually.

maxSurge: how many extra pods can run during update (1 here).

maxUnavailable: how many pods can be down during update (1 here).

This setup allows progressive delivery by updating pods one by one safely.

Commands
This command creates or updates the Deployment with the new app version and rolling update strategy.
Terminal
kubectl apply -f deployment.yaml
Expected OutputExpected
deployment.apps/my-app created
This command checks the progress of the rolling update to ensure pods update successfully one by one.
Terminal
kubectl rollout status deployment/my-app
Expected OutputExpected
deployment "my-app" successfully rolled out
This command lists all pods of the app to see how many are running the new version during the rollout.
Terminal
kubectl get pods -l app=my-app
Expected OutputExpected
NAME READY STATUS RESTARTS AGE my-app-5d8f7c7d7f-abc12 1/1 Running 0 2m my-app-5d8f7c7d7f-def34 1/1 Running 0 1m my-app-5d8f7c7d7f-ghi56 1/1 Running 0 30s my-app-5d8f7c7d7f-jkl78 1/1 Running 0 10s my-app-5d8f7c7d7f-mno90 1/1 Running 0 5s
If the new version causes problems, this command rolls back to the previous stable version quickly.
Terminal
kubectl rollout undo deployment/my-app
Expected OutputExpected
deployment.apps/my-app rolled back
Key Concept

If you remember nothing else from this pattern, remember: update your app gradually to catch problems early and keep users safe.

Common Mistakes
Setting maxUnavailable to 0 during rolling update
This prevents any pod from being unavailable, which can delay updates and cause longer rollout times.
Set maxUnavailable to at least 1 to allow one pod to update at a time for smooth progressive delivery.
Not checking rollout status after applying update
You might miss errors or failed updates causing downtime or broken app versions.
Always run 'kubectl rollout status' to monitor update progress and catch issues early.
Deploying new version to all pods at once
This causes full downtime or exposes all users to bugs at once.
Use rolling update strategy with maxSurge and maxUnavailable to update pods gradually.
Summary
Create a Deployment with rolling update strategy to update pods gradually.
Use 'kubectl apply' to deploy changes and 'kubectl rollout status' to monitor progress.
Roll back quickly with 'kubectl rollout undo' if problems occur during update.