Deploy an image to an Azure Kubernetes Service cluster on Azure Stack Hub

You can use your Azure Stack Hub Azure Container Registry (ACR) to store images. You can use these images when you deploy to an Azure Kubernetes Service (AKS) cluster in the same environment.

Deploy an app to your cluster

To deploy a sample app to your AKS cluster, see Tutorial: Prepare an application for Azure Kubernetes Service (AKS).

Note

The -attach-acr option when creating an Azure Kubernetes Service cluster is not yet supported. You must use a service principal (SPN) ID and corresponding secret, and use the same ID and secret in Kubernetes. For more information, see Azure Container Registry authentication with service principals.

Considerations

The following considerations to remember from the online guidance are:

  • You need an SPN and must grant AcrPull access to the subscription, resource group, or container registry resource.

  • You must create a secret in Kubernetes using that same SPN:

    $userSPNID = "<SPN GUID>"
    $userSPNSecret = "<SPN Secret GUID>"
    
    kubectl create secret docker-registry <secret name> `
         --docker-server=<myregistry>.azsacr.<region>.<fqdn> `
         --docker-username=$userSPNID `
         --docker-password=$userSPNSecret
    
  • Update your YAML to reference the secret as part of the deployment:

    imagePullSecrets: `
       - name: <secret name>
    

Next steps

Learn more about the Azure Container Registry on Azure Stack Hub