This project demonstrates the deployment of an NGINX application on an Azure Kubernetes Service (AKS) cluster. The infrastructure is provisioned using Terraform, and the application deployment is managed via Helm. The deployment is automated with a GitHub Actions pipeline, ensuring seamless integration and deployment.
Before using this project, ensure you have the following:
-
Tools:
-
Accounts and Permissions:
- Azure account with sufficient privileges to create resource groups and AKS clusters.
- GitHub Secrets configured for authentication (see below).
-
Secrets Configuration: Add the following secrets to your GitHub repository:
AZURE_CREDENTIALS
: Contains the Azure service principal credentials for authentication.
- Initialize Terraform:
cd terraform
terraform init
- Plan Deployment:
terraform plan
- Apply Deployment:
terraform apply -auto-approve
This will create:
- A resource group
- An AKS cluster with a system-assigned identity and a default node pool
- Outputs: After successful deployment, Terraform outputs the resource group name and AKS cluster name.
- Configure AKS Credentials:
az aks get-credentials --resource-group projectrsgrp --name akscluster
- Deploy NGINX with Helm:
helm upgrade --install nginx-release ./helm
The pipeline automates the deployment process:
- Terraform Job:
- Initializes, plans, and applies Terraform to provision the infrastructure.
- Outputs the AKS cluster and resource group details.
- Helm Deployment Job:
- Waits for the Terraform job to complete.
- Authenticates with Azure, retrieves AKS credentials, and deploys the NGINX application using Helm.
The pipeline can be triggered manually via GitHub’s workflow dispatch.
-
Access the NGINX Service: Once deployed, the NGINX service can be accessed via the public IP assigned by the Kubernetes LoadBalancer.
-
Verify Deployment:
- Check the pods:
kubectl get pods
- Check the service:
kubectl get svc
- Terraform Errors:
- Ensure Azure credentials are valid.
- Verify Terraform syntax with terraform validate.
- Helm Deployment Issues:
- Ensure the AKS cluster credentials are correctly retrieved.
- Check Helm logs:
helm list
- Pipeline Failures:
- Review logs for each job in GitHub Actions for details on errors.