- Action: Edit code, commit
- Trigger:
git push
This project consists of 3 layers: Infrastructure, Application, and Configuration
/aks-terraform
/app-source-code
/app-manifests
git pushDeveloper makes changes to the .NET API source code and commits to the local Git repository. Running git push uploads the changes to GitHub, which automatically triggers the CI/CD pipeline.
Source Repository containing:
Program.cs)Dockerfile)build-and-push.yml)GitHub repository stores the application source code, Dockerfile for containerization, and GitHub Actions workflow files. When code is pushed, webhooks trigger the automated build pipeline.
docker build (e.g., signin-api:abc123)docker push to ACR (Flow 1)app-manifests repodeployment.yaml (sed command)git commit and git push (Flow 2)GitHub Actions runs two sequential jobs: (1) Build the Docker image and push to Azure Container Registry, (2) After build completes, update the Kubernetes manifest with the new image tag and commit to the manifests repo. This ensures the code and configuration stay in sync.
Azure Container Registry stores the built Docker images. Each image is tagged with a unique identifier (commit SHA) for version tracking. AKS pulls images from here during deployment.
Kubernetes manifests repository stores deployment configurations. GitHub Actions automatically updates the image tag in deployment.yaml to match the newly built image, keeping infrastructure as code.
app-manifests repo.kubectl apply -f deployment.yaml.Flux CD runs inside AKS and continuously monitors the manifests repository. When it detects changes, it automatically applies them to the cluster using kubectl, ensuring the cluster state matches Git (GitOps principle).
AKS pulls the new Docker image from ACR and performs a rolling update, gradually replacing old pods with new ones to ensure zero downtime. The LoadBalancer service exposes the API to external traffic.
End users access the API through the LoadBalancer's external IP address. They automatically receive responses from the newly deployed version with zero downtime during the update process.