A cloud-native application deployed on Azure AKS with automated CI/CD pipelines.
Deploy in 5 minutes!
This project automates:
- Infrastructure provisioning (Azure AKS, networking) using Terraform.
- Post-infra configuration (NSG rules, protocols) via Ansible.
- Multi-environment Kubernetes deployments (e.g.,
training
) using Kustomize. - CI/CD pipelines to build/push Docker images on code changes or version tags.
- Install:
- Azure CLI, Terraform, Ansible,
kubectl
, Kustomize, Docker - Configure Docker Hub, GitHub credentials and ensure Docker is running.
- Create a ressource group
secrets-rg
for all sensitive components. - Create a
AdminSecretsKeyVault
insidesecrets-rg
with RBAC access model - Asign
Admin
access for yourself andContributor
access for thewebapp
service pricipal. - Initialise the framework with
./init.sh
- Azure CLI, Terraform, Ansible,
# Terraform plan for the "testing" environment.
./rollout.sh testing # Creates AKS cluster and networking
ansible-playbook fix_aks_nsg.yml # Fix NSG rules (SSH/HTTP/custom protocols)
kubectl apply -k overlays/training # Deploy using Kustomize overlay
kubectl get pods -n testing # Check pod status
Access the app (testing): http://4.158.73.52
- Trigger: Changes to
src/
directory - Action:
- Builds Docker image.
- Pushes to Docker Hub as
latest
(no version tag). - Triggers Kubernetes pods rebuild to pull the latest image.
- Trigger: Trigger: Pushing a semantic version tag:
git tag v2.0.0 && git push origin --tags
- Action:
- Builds two Docker tags:
- Versioned (e.g.,
v3.0.0
). latest
(updated to match the new version).
- Versioned (e.g.,
- Older versions (e.g.,
v2.0.0
,v2.0.1
) remain in Docker Hub for rollbacks.
- Builds two Docker tags:
- Docker Hub Tags::
latest
: Always points to the newest release (e.g., same asv3.0.0
).- Version tags (e.g.,
v2.0.0
): Immutable snapshots for rollbacks.
Example: After tagging v2.0.1
:
Docker Hub Tags: v2.0.0 (old), v2.0.1 (new), latest (same as v2.0.1)
base/
├── .github/workflows/ # GitHub Actions pipelines:
│ ├── build-push-on-main.yml # Trigger on merge to main
│ └── docker-build-push-on-tag.yml # Trigger on version tags
├── kubernetes/
│ ├── base/
│ └── overlays/ # Kubernetes environment configs (e.g., testing)
├──terraform/ # Terraform environment setup (e.g., AKS)
│ └── modules/
│ ├── aks/
│ └── network/
├── src/ # App folder containing the Dockerfile
│ └── Dockerfile
├── init.sh # Creates full project framework with all files folders.
├── rollout.sh # Terraform/Kustomize deployment script
└── deploy.sh # (Optional) Kubernetes post-deployment script
- Rollback to a version:
kubectl set image deployment/flask-app-deployment -n testing flask-app=your-dockerhub-image:v2.0.0
- Check pod logs::
kubectl logs -n testing <pod-name>
Questions? Check the framework_code/README.txt for detailed framework documentation.