Skip to content

Architecture

Infrastructure and deployment architecture for the Octo E-Shop platform on Microsoft Azure.

Azure Architecture

The Octo E-Shop platform runs on Azure Kubernetes Service (AKS) with a full suite of managed Azure services. Infrastructure is provisioned via Terraform and deployed across three environments: dev, staging, and production.

ServicePurpose
Azure Kubernetes Service (AKS)Container orchestration for all microservices
Azure Container Registry (ACR)Private Docker image registry
Azure Database for PostgreSQLManaged databases for user, product, and order services
Azure Cache for RedisSession and cart data store
Azure Service BusAsynchronous messaging between services
Azure Key VaultSecrets and certificate management
Azure Storage AccountTerraform state backend and static assets
Azure Log Analytics & Application InsightsMonitoring, logging, and diagnostics
Network Security Groups (NSG)Network-level access control
Azure Load BalancerPublic ingress for the frontend

Each environment is deployed into its own Virtual Network (VNet) with dedicated subnets:

SubnetDevStagingProductionPurpose
AKS Subnet10.0.1.0/2410.10.1.0/2410.20.1.0/24Kubernetes node pool
Database Subnet10.0.2.0/2410.10.2.0/2410.20.2.0/24PostgreSQL flexible servers (delegated)
Redis Subnet10.0.3.0/2410.10.3.0/2410.20.3.0/24Azure Cache for Redis

Network Policies (Kubernetes-level) restrict pod-to-pod communication and egress to database subnets. NSG rules control network-level access at the Azure layer.

ResourceDevStagingProduction
AKS Nodes1 × Standard_D2s_v32 × Standard_D2s_v33 × Standard_D4s_v3
PostgreSQLB_Standard_B1msB_Standard_B1msGP_Standard_D4s_v3 (Zone Redundant HA)
RedisBasic/C0Basic/C0Premium/P1
ACRBasicStandardPremium

All infrastructure is managed with Terraform using a modular structure:

infrastructure/terraform/
├── modules/
│ ├── aks/ # Kubernetes cluster
│ ├── acr/ # Container registry
│ ├── postgresql/ # Database servers
│ ├── redis/ # Cache instances
│ ├── networking/ # VNet, subnets, NSGs
│ ├── keyvault/ # Secrets management
│ ├── servicebus/ # Message bus
│ ├── storage/ # Storage accounts
│ └── monitoring/ # Log Analytics + App Insights
└── environments/
├── dev/
├── staging/
└── production/

State is stored remotely in Azure Storage with Azure AD authentication.

The Terraform state backend and Azure service principal are created by a one-time bootstrap script:

Terminal window
./scripts/bootstrap-backend.sh --subscription <sub-id> --repo <owner/repo>
Terminal window
# Plan changes (safe — no modifications)
gh workflow run infrastructure.yml -f environment=dev -f action=plan
# Apply after reviewing
gh workflow run infrastructure.yml -f environment=dev -f action=apply

After Terraform provisions the AKS cluster, the cluster-setup.yml workflow installs:

ComponentPurpose
ingress-nginxKubernetes Ingress controller for HTTP routing
External Secrets OperatorSyncs secrets from Azure Key Vault to Kubernetes secrets
ClusterSecretStoreConnects ESO to Azure Key Vault via workload identity
Managed Identity + Fed CredEnables passwordless authentication from ESO to Key Vault
  • Secrets: Stored in Azure Key Vault, synced to GitHub Environment secrets and Kubernetes secrets
  • Network: NSG rules + Kubernetes NetworkPolicies restrict traffic per environment
  • Registry: ACR credentials automatically synced to GitHub secrets
  • Authentication: Azure service principal with RBAC, AKS workload identity for Key Vault
  • Scanning: Trivy container vulnerability scanning in CI pipeline