All Products
Search
Document Center

Container Service for Kubernetes:Use an image cache to accelerate workflow pod creation

Last Updated:Mar 26, 2026

Pulling large container images from a registry on every pod start slows down workflow execution. This document shows how to configure password-free pulls from a Container Registry Enterprise Edition (ACR EE) instance and how to use image caches to skip redundant pulls and accelerate pod creation.

Prerequisites

Before you begin, ensure that you have:

Configure password-free image pulls

Add the k8s.aliyun.com/acr-instance-id annotation to spec.podMetadata.annotations in your workflow.yaml. Set the value in Region ID:Instance ID format.

apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
  generateName: hello-world-
spec:
  entrypoint: whalesay
  podMetadata:
    annotations:
      k8s.aliyun.com/acr-instance-id: "cn-hangzhou:cri-f34lmbk2rxqx41u8"   # Region ID and instance ID of the ACR EE instance
  templates:
    - name: whalesay
      container:
        image: acr-en-hangzhou-registry.cn-hangzhou.cr.aliyuncs.com/workflow/whalesay   # Image to pull from the ACR EE instance
        command: [ cowsay ]
        args: [ "hello world" ]

If the workflow and the ACR EE instance are in the same region, omit the region ID and set the value to just the instance ID.

Create workflow pods using image caches

Image caches store pulled images so subsequent pod starts skip the pull entirely. Choose between automatic and manual creation based on your needs.

Automatically create an image cache

Add the k8s.aliyun.com/eci-image-cache: "true" annotation to spec.podMetadata.annotations. If an image cache of the specified image already exists, the workflow automatically uses the existing image cache to create a pod. This accelerates pod creation.

apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
  generateName: hello-world-
spec:
  podMetadata:
    annotations:
      k8s.aliyun.com/eci-image-cache: "true"   # Enable automatic image caching
  entrypoint: whalesay
  templates:
    - name: whalesay
      container:
        image: docker/whalesay
        command: [ cowsay ]
        args: [ "hello world" ]

Manually create an image cache

Use this method when you need to set a specific cache size or configure a retention period.

Step 1: Create the image cache

Create a file named imagecache.yaml with the following content:

apiVersion: eci.alibabacloud.com/v1
kind: ImageCache
metadata:
  name: imagecache-helloworld
  annotations:
    k8s.aliyun.com/imc-enable-reuse: "true"   # Allow the cache to be reused
spec:
  images:                       # Images to cache
  - docker/whalesay
  imagePullSecrets:             # Secrets for private images; not required for public images
  - default:secret1
  imageCacheSize:               # Cache size in GiB. Default: 20. Valid range: 20-32768
   20
  retentionDays:                # Days before the cache expires. Leave blank for no expiration
   7

Apply the file:

kubectl apply -f imagecache.yaml

Step 2: Verify the image cache is ready

kubectl get imagecaches

Wait until PHASE shows Ready and PROGRESS reaches 100%:

NAME                    AGE     CACHEID        PHASE   PROGRESS
imagecache-helloworld   3m36s   imc-f8zfxxxx   Ready   100%

Step 3: Reference the image cache in your workflow

Copy the CACHEID from the output above and set it as the value of the k8s.aliyun.com/eci-image-snapshot-id annotation:

apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
  generateName: hello-world-
spec:
  podMetadata:
    annotations:
      k8s.aliyun.com/eci-image-snapshot-id: "imc-f8zf****"   # Image cache ID from kubectl get imagecaches
  entrypoint: whalesay
  templates:
    - name: whalesay
      container:
        image: docker/whalesay
        command: [ cowsay ]
        args: [ "hello world" ]

What's next