Azure Kubernetes Service (AKS) gere le plan de controle Kubernetes pour vous. En contrepartie, il impose certaines contraintes d’integration avec l’ecosysteme Azure.
Creer un cluster AKS production-ready
az aks create --resource-group prod-rg --name prod-aks --kubernetes-version 1.29.0 --node-count 3 --node-vm-size Standard_D4s_v3 --enable-managed-identity --enable-addons monitoring --network-plugin azure --zones 1 2 3 --enable-cluster-autoscaler --min-count 2 --max-count 10
Integrer Azure Container Registry
az aks update --name prod-aks --resource-group prod-rg --attach-acr myregistry
# Pas besoin d'imagePullSecrets
spec:
containers:
- name: api
image: myregistry.azurecr.io/myapp:1.2.3
Pipeline GitLab vers AKS
variables:
IMAGE: myregistry.azurecr.io/myapp:$CI_COMMIT_SHA
build:
script:
- az acr login --name myregistry
- docker build -t $IMAGE .
- docker push $IMAGE
deploy:
script:
- az aks get-credentials --resource-group prod-rg --name prod-aks
- kubectl set image deployment/api api=$IMAGE
- kubectl rollout status deployment/api
rules:
- if: $CI_COMMIT_BRANCH == "main"
Notre formation Azure couvre AKS avec des ateliers sur cluster reel.