Listen to this Post

Blue-green deployments are a critical strategy for minimizing downtime and risk during application updates. This approach involves running two identical production environments: one (blue) hosts the current version, while the other (green) deploys the new version. Traffic is gradually shifted from blue to green, allowing for seamless rollback if issues arise.
Argo Rollouts enhances Kubernetes deployments by automating blue-green and canary strategies, reducing manual intervention. Below, we explore how to implement this using Argo Rollouts.
You Should Know:
1. Install Argo Rollouts
First, deploy Argo Rollouts in your Kubernetes cluster:
kubectl create namespace argo-rollouts kubectl apply -n argo-rollouts -f https://github.com/argoproj/argo-rollouts/releases/latest/download/install.yaml
Verify installation:
kubectl get pods -n argo-rollouts
2. Define a Blue-Green Rollout
Create a Rollout manifest (`rollout.yaml`):
apiVersion: argoproj.io/v1alpha1 kind: Rollout metadata: name: example-app spec: replicas: 3 strategy: blueGreen: activeService: example-app-active previewService: example-app-preview autoPromotionEnabled: false selector: matchLabels: app: example-app template: metadata: labels: app: example-app spec: containers: - name: example-app image: your-app:v1 ports: - containerPort: 8080
Apply it:
kubectl apply -f rollout.yaml
3. Deploy and Promote
Update the image to trigger a new deployment:
kubectl argo rollouts set image example-app example-app=your-app:v2
Monitor progress:
kubectl argo rollouts get rollout example-app --watch
Manually promote after testing:
kubectl argo rollouts promote example-app
4. Rollback if Needed
If issues occur, revert to the previous version:
kubectl argo rollouts undo example-app
5. Automate Promotion
To auto-promote after a delay, modify the Rollout:
blueGreen: autoPromotionSeconds: 30
6. Useful Commands
- List all rollouts:
kubectl argo rollouts list rollouts
- View rollout history:
kubectl argo rollouts history example-app
- Abort a rollout:
kubectl argo rollouts abort example-app
What Undercode Say
Blue-green deployments with Argo Rollouts streamline Kubernetes updates, reducing risk and downtime. By automating traffic shifting and rollbacks, teams ensure smoother deployments. Key takeaways:
– Use `kubectl argo rollouts` for managing deployments.
– Monitor with `–watch` to track progress.
– Always test in the preview environment before promoting.
– Automate promotions cautiously to avoid premature releases.
For further reading, check the official Argo Rollouts documentation.
Expected Output:
A fully automated blue-green deployment process in Kubernetes with Argo Rollouts, ensuring zero-downtime updates and quick rollback capabilities.
References:
Reported By: Darryl Ruggles – Hackers Feeds
Extra Hub: Undercode MoN
Basic Verification: Pass ✅


