Muokkaa

Jaa


Reduce image pull time with Artifact Streaming on Azure Kubernetes Service (AKS) (Preview)

High performance compute workloads often involve large images, which can cause long image pull times and slow down your workload deployments. Artifact Streaming on AKS allows you to stream container images from Azure Container Registry (ACR) to AKS. AKS only pulls the necessary layers for initial pod startup, reducing the time it takes to pull images and deploy your workloads.

Artifact Streaming can reduce time to pod readiness by over 15%, depending on the size of the image, and it works best for images <30GB. Based on our testing, we saw reductions in pod start-up times for images <10GB from minutes to seconds. If you have a pod that needs access to a large file (>30GB), then you should mount it as a volume instead of building it as a layer. This is because if your pod requires that file to start, it congests the node. Artifact Streaming isn't ideal for read heavy images from your filesystem if you need that on startup. With Artifact Streaming, pod start-up becomes concurrent, whereas without it, pods start in serial.

This article describes how to enable the Artifact Streaming feature on your AKS node pools to stream artifacts from ACR.

Important

AKS preview features are available on a self-service, opt-in basis. Previews are provided "as is" and "as available," and they're excluded from the service-level agreements and limited warranty. AKS previews are partially covered by customer support on a best-effort basis. As such, these features aren't meant for production use. For more information, see the following support articles:

Prerequisites

Note

Artifact Streaming is only supported on Ubuntu 22.04, Ubuntu 20.04, and Azure Linux node pools. Windows node pools aren't supported.

Install the aks-preview CLI extension

  1. Install the aks-preview CLI extension using the az extension add command.

    az extension add --name aks-preview
    
  2. Update the extension to ensure you have the latest version installed using the az extension update command.

    az extension update --name aks-preview
    

Register the ArtifactStreamingPreview feature flag in your subscription

  • Register the ArtifactStreamingPreview feature flag in your subscription using the az feature register command.

    az feature register --namespace Microsoft.ContainerService --name ArtifactStreamingPreview
    

Enable Artifact Streaming on ACR

Enablement on ACR is a prerequisite for Artifact Streaming on AKS. For more information, see Artifact Streaming on ACR.

  1. Create an Azure resource group to hold your ACR instance using the az group create command.

    az group create --name myStreamingTest --location westus
    
  2. Create a new premium SKU Azure Container Registry using the az acr create command with the --sku Premium flag.

    az acr create --resource-group myStreamingTest --name mystreamingtest --sku Premium
    
  3. Configure the default ACR instance for your subscription using the az configure command.

    az configure --defaults acr="mystreamingtest"
    
  4. Push or import an image to the registry using the az acr import command.

    az acr import --source docker.io/jupyter/all-spark-notebook:latest --repository jupyter/all-spark-notebook:latest
    
  5. Create a streaming artifact from the image using the az acr artifact-streaming create command.

    az acr artifact-streaming create --image jupyter/all-spark-notebook:latest
    
  6. Verify the generated Artifact Streaming using the az acr manifest list-referrers command.

    az acr manifest list-referrers --name jupyter/all-spark-notebook:latest
    

Enable Artifact Streaming on AKS

Enable Artifact Streaming on a new node pool

  • Create a new node pool with Artifact Streaming enabled using the az aks nodepool add command with the --enable-artifact-streaming.

    az aks nodepool add \
        --resource-group myResourceGroup \
        --cluster-name myAKSCluster \
        --name myNodePool \
        --enable-artifact-streaming
    

Enable Artifact Streaming on an existing node pool

  • Update an existing node pool to enable Artifact Streaming using the az aks nodepool update command with the --enable-artifact-streaming.

    az aks nodepool update \
        --resource-group myResourceGroup \
        --cluster-name myAKSCluster \
        --name myNodePool \
        --enable-artifact-streaming
    

Check if Artifact Streaming is enabled

Now that you enabled Artifact Streaming on a premium ACR and connected that to an AKS node pool with Artifact Streaming enabled, any new pod deployments on this cluster with an image pull from the ACR with Artifact Streaming enabled will see reductions in image pull times.

  • Check if your node pool has Artifact Streaming enabled using the az aks nodepool show command.

    az aks nodepool show --resource-group myResourceGroup --cluster-name myAKSCluster --name myNodePool --query artifactStreamingProfile
    

    In the output, check that the Enabled field is set to true.

Next steps

This article described how to enable Artifact Streaming on your AKS node pools to stream artifacts from ACR and reduce image pull time. To learn more about working with container images in AKS, see Best practices for container image management and security in AKS.