Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
54 lines (40 sloc) 2.25 KB
title layout permalink published tags excerpt image unsplash_user_name unsplash_user_ref
AKS and ACR Integration - Revisited
post
aks-and-acr-integration-revisited
true
Kubernetes
AKS
ACR
Integrating AKS and ACR to pull images from private Container Registries became easier with recent Azure CLI 2.0 releases. Check out how easy you can connect both excellent services.
/containers-on-dock.jpg
Tobias A. Müller
tobiasamueller

Back in 2017, I published [this]({%post_url 2017-08-18-how-to-use-a-private-azure-container-registry-with-kubernetes %}) article on integrating Kubernetes with ACR. Since that time, a lot has changed in the world of containers and orchestrators. Especially Microsoft is pushing hard in the Kubernetes area and keeps on shipping features regularly as part of their managed Kubernetes offering. The integration of ACR and AKs became even more comfortable since Azure CLI 2.0.73 has been released. That said, let's check out how smooth the integration is.

At the end of the article, you will be able to integrate ACR with either new AKS clusters or pre-existing AKS instances.

Integrate ACR when creating a new AKS cluster

First, let's see how ACR can be integrated with AKS when spinning up a new AKS instance.

ACR_NAME=<<your-acr-name>>
ACR_RESOURCE_GROUP=<<your-acr-ressource-group>>

az acr create --name $ACR_NAME \
    --resource-group $ACR_RESOURCE_GROUP \
    --sku basic

ACR_ID=$(az acr show --name $ACR_NAME \
     --resource-group $ACR_RESOURCE_GROUP \
     --query "id" --output tsv)

az aks create --name shiny-new-aks \
    --resource-group rg-shiny-new-aks \
    --attach-acr $ACR_ID

Configure ACR integration with existing AKS cluster

Perhaps you have already created an AKS cluster; if that is the case, you can attach an ACR instance using the az aks update command. Before you can issue the az aks update command, you have to provide necessary information about your ACR instance:

ACR_NAME=<<your-acr-name>>
ACR_RESOURCE_GROUP=<<your-acr-ressource-group>>

ACR_ID=$(az acr show --name $ACR_NAME \
     --resource-group $ACR_RESOURCE_GROUP \
     --query "id" --output tsv)

az aks update --name <<your-aks-name>> \
    --resource-group <<your-aks-resource-group-name>> \
    --attach-acr $ACR_ID
You can’t perform that action at this time.