In microservices, you are deploying code dozens of times per week. Manual deployment is a recipe for disaster. CI/CD (Continuous Integration / Continuous Deployment) automates the journey of your code from git push to the production cluster.
Every time you push code, the pipeline: (1) Restores Nuget packages, (2) Builds the project, (3) Runs Unit Tests, (4) Scans for Security vulnerabilities, and (5) Builds a Docker Image.
The pipeline then: (1) Pushes the Docker image to a registry (like Azure Container Registry), (2) Updates the Kubernetes manifest or Helm chart, and (3) Triggers a Rolling Update in the cluster.
# GitHub Actions Example
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build & Publish
run: dotnet publish -c Release
Q: "What is a 'Blue/Green Deployment' and how does it reduce risk?"
Architect Answer: "Blue/Green deployment maintains two identical production environments. 'Blue' is the current live version. 'Green' is the new version. You deploy to Green, test it privately, and then simply flip a switch in the Load Balancer to point traffic to Green. If anything goes wrong, you flip the switch back to Blue in milliseconds. This is the ultimate tool for zero-downtime, low-risk releases."