Developers want ephemeral environments per PR on Azure. How do you build it?
AdvancedScenarioCI/CD and IaC
Answer
Situation read → Namespace per PR on a shared AKS cluster (cheap) or RG per PR (more isolation).
What I'd do →
- On PR open: create namespace
pr-123, deploy with Helm using the PR image, ingress hostpr-123.dev.devopsshack.com - Backing services: shared dev database with a per-PR schema, or containers in the namespace
- Comment the URL on the PR
- On PR close:
helm uninstalland delete the namespace; nightly cleanup of orphaned namespaces by label age
Why → Reviewers test real deployments; namespaces keep cost low.
Interview tip → Mention cleanup automation; orphaned environments are the cost trap.
More on CI/CD and IaC
Design a GitHub Actions pipeline that builds an image, pushes to ACR and deploys to AKS with no secrets.IntermediateYour organisation uses Azure DevOps. Set up a secure deployment pipeline to AKS.IntermediateYou need to promote the same image from dev to staging to prod. How do you design it?IntermediateTerraform state for prod is in a storage account accessible with account keys. Harden it.IntermediateYour team wants to move from ARM JSON templates to Bicep. How do you migrate?BeginnerA pipeline needs to deploy to dev, test and prod in different subscriptions. How do you handle identities?Advanced