Skip to content

Stage 1 : Create and Configure Azure Services

Sanoobk edited this page Sep 21, 2019 · 1 revision

Stage 1: Create and Configure Azure Services

1. Create Azure Resource Group, Azure Container Registry and Azure Kubernetes Service instance

az group create -n CICDDemoRG -l westeurope

az acr create -g CICDDemoRG -n DemoACR777 --sku Basic

2. Create AKS and Provide the Service Principal access to ACR to pull images to AKS.

Its good to read below article before deciding to create the AKS. Make a decision to use Custom Service Principal or the AKS generated Service Principal to give access to ACR later. For development tenants with Tenant access, you could use 2.a

https://docs.microsoft.com/en-gb/azure/container-registry/container-registry-auth-aks?toc=%2fazure%2faks%2ftoc.json#grant-aks-access-to-acr

2.a If Custom Service Principal is not needed, run the below command or skip to 2.b az aks create -g CICDDemoRG -n CICDAKS --node-count 1 --generate-ssh-keys --enable-addons monitoring

2.b If a custom service principal is needed, then the below steps can be used to create the Service Principal and then use the same to create AKS and then provide access to ACR to pull images.

az ad sp create-for-rbac --skip-assignment

az aks create -g CICDDemoRG -n CICDAKS --service-principal xxxxxxxxxx --client-secret xxxxxx --node-count 1 --enable-addons monitoring --generate-ssh-keys

2.c Provide access for AKS Service Principal to ACR using scripts from the below link based on how the the Service Principal was created from 2.a or 2.b https://docs.microsoft.com/en-gb/azure/container-registry/container-registry-auth-aks?toc=%2fazure%2faks%2ftoc.json#grant-aks-access-to-acr

3. Install Kubectl (CLI tool for Kubernetes) if not already. For cloud shell the az aks install-cli not needed as Kubectl tool is already installed. az aks install-cli

az aks get-credentials -g CICDDemoRG -n CICDAKS

Test if Kubectl has permissions to the AKS Cluster

Kubectl get nodes