Continuous Integration and Continuous Delivery (CI/CD) automate the process of building, testing, and deploying software. Modern cloud-native systems rely on safe deployment strategies and declarative infrastructure workflows to reduce risk and improve reliability.
Developers frequently merge code into a shared repository. Each merge triggers:
flowchart LR
Dev[Developer] -->|Push Code| Git[Git Repository]
Git --> CI[CI Pipeline]
CI --> Build[Build Artifact]
CI --> Test[Run Tests]
CI --> Scan[Security / Lint]
After CI succeeds, the system:
flowchart LR
Artifact[Artifact Registry] --> Staging[Deploy to Staging]
Staging --> Approval{Manual Approval?}
Approval -->|Yes| Prod[Deploy to Production]
Approval -->|No| Prod
Deployment strategies reduce risk when releasing new versions.
Two identical environments:
Traffic switches only after validation.
flowchart LR
Users --> LB[Load Balancer]
LB --> Blue[Blue v1]
LB -. switch .-> Green[Green v2]
Release to a small percentage of users first.
flowchart LR
Users --> LB[Load Balancer]
LB -->|90%| v1[Version 1]
LB -->|10%| v2[Version 2 - Canary]
Gradually increase traffic if metrics are healthy.
Deploy v2
Route 5–10% traffic
Monitor:
Gradually increase traffic
Incrementally replace pods/instances.
flowchart LR
Old1[Pod v1] --> New1[Pod v2]
Old2[Pod v1] --> New2[Pod v2]
Old3[Pod v1] --> New3[Pod v2]
Common in Kubernetes using:
yamlstrategy: type: RollingUpdate rollingUpdate: maxUnavailable: 1 maxSurge: 1
The CI server pushes changes to the cluster.
flowchart LR
Dev --> Git
Git --> CI
CI -->|kubectl apply| Cluster
The cluster pulls desired state from Git.
Used in GitOps.
flowchart LR
Dev --> Git
Git --> Agent[GitOps Agent]
Agent --> Cluster
Examples:
| Aspect | Push | Pull |
|---|---|---|
| Who initiates deployment | CI server | Cluster agent |
| Credentials location | CI | Cluster |
| Drift detection | Manual | Automatic |
| Security model | Broader access | Reduced CI privileges |
| Multi-cluster scaling | Harder | Easier |
GitOps is an operational model where:
flowchart TD
Dev[Developer] -->|Commit| GitRepo[Git Repository]
GitRepo --> Agent[ArgoCD / Flux]
Agent -->|Apply Desired State| Cluster[Kubernetes Cluster]
Cluster -->|Report Status| Agent
sequenceDiagram
participant Agent
participant Git
participant Cluster
Agent->>Git: Check desired state
Agent->>Cluster: Compare actual state
Agent->>Cluster: Apply changes if drift detected
Combines:
Often implemented with:
Separate deployment from release.
flowchart LR
Deploy[Deploy New Code] --> FeatureFlag{Feature Enabled?}
FeatureFlag -->|Yes| NewFeature
FeatureFlag -->|No| Hidden
Benefits:
flowchart LR
Dev --> Git
Git --> CI[Build & Test]
CI --> Registry[Push Docker Image]
Git --> ConfigRepo[Update Helm Chart]
ConfigRepo --> ArgoCD
ArgoCD --> Cluster
Cluster --> Users