Skip to main content

Deployment Guide

This guide covers the deployment strategies supported by DevOpsGenie, when to use each one, and how to configure them in your GitOps repository.

Deployment Strategies

DevOpsGenie supports four deployment strategies via Argo Rollouts:

StrategyRiskSpeedBest For
RollingMediumFastNon-critical services, internal tools
Blue/GreenLowMediumAPIs, user-facing services
CanaryVery LowSlowHigh-traffic, revenue-critical services
A/B TestingLowMediumFeature experimentation

Rolling Deployments

Rolling deployments are the default. They gradually replace old pods with new ones while maintaining availability.

kubernetes/apps/my-service.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: my-service
spec:
replicas: 6
strategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 2
maxUnavailable: 0
# ... rest of spec
caution

Setting maxUnavailable: 0 ensures zero downtime but requires sufficient cluster capacity for surge pods. Budget for this in your resource quotas.

Blue/Green Deployments

Blue/green deployments maintain two identical environments. Traffic is switched atomically from the live (blue) to the new (green) version once readiness is confirmed.

gitops/rollouts/my-service-rollout.yaml
apiVersion: argoproj.io/v1alpha1
kind: Rollout
metadata:
name: my-service
namespace: team-platform
spec:
replicas: 6
strategy:
blueGreen:
activeService: my-service-active
previewService: my-service-preview
autoPromotionEnabled: false
prePromotionAnalysis:
templates:
- templateName: error-rate
args:
- name: service-name
value: my-service-preview
postPromotionAnalysis:
templates:
- templateName: success-rate
selector:
matchLabels:
app: my-service
template:
metadata:
labels:
app: my-service
spec:
containers:
- name: my-service
image: your-ecr-repo/my-service:v2.1.0

Canary Deployments

Canary deployments route a small percentage of traffic to the new version, analyze metrics, and promote or roll back based on thresholds.

gitops/rollouts/my-service-canary.yaml
apiVersion: argoproj.io/v1alpha1
kind: Rollout
metadata:
name: my-service
namespace: team-platform
spec:
replicas: 10
strategy:
canary:
canaryService: my-service-canary
stableService: my-service-stable
trafficRouting:
alb:
ingress: my-service-ingress
servicePort: 80
steps:
- setWeight: 5
- pause: {duration: 2m}
- analysis:
templates:
- templateName: error-rate-check
- setWeight: 20
- pause: {duration: 5m}
- analysis:
templates:
- templateName: latency-check
- setWeight: 50
- pause: {duration: 10m}
- setWeight: 100
analysis:
successfulRunHistoryLimit: 3
unsuccessfulRunHistoryLimit: 3

Analysis Templates

Analysis templates define the automated quality gates for promotion:

gitops/analysis/error-rate-check.yaml
apiVersion: argoproj.io/v1alpha1
kind: AnalysisTemplate
metadata:
name: error-rate-check
namespace: team-platform
spec:
metrics:
- name: error-rate
interval: 60s
count: 5
successCondition: result[0] < 0.05
failureLimit: 2
provider:
prometheus:
address: http://prometheus.monitoring.svc.cluster.local:9090
query: |
sum(rate(http_requests_total{job="{{args.service-name}}", status=~"5.."}[2m]))
/
sum(rate(http_requests_total{job="{{args.service-name}}"}[2m]))

Rollback Procedures

Automatic Rollback

Argo Rollouts rolls back automatically when analysis fails:

# Verify rollback status
kubectl argo rollouts get rollout my-service -n team-platform --watch

Manual Rollback

# Immediate rollback to previous version
kubectl argo rollouts undo my-service -n team-platform

# Rollback to a specific revision
kubectl argo rollouts undo my-service -n team-platform --to-revision=5

GitOps Rollback

For a full GitOps-compliant rollback, revert the image tag in Git:

git revert HEAD
git push origin main
# ArgoCD will reconcile within 3 minutes (or trigger manually)
argocd app sync my-service

Next Steps