Updated on 2025-09-23 GMT+08:00

Creating an Image Cache

You can pull images from the SWR image repository, open-source image repositories, and other image repositories to create image caches. When creating a workload, you can use an image cache to obtain the images. In this way, image download is accelerated, and the workload startup speed is improved. Figure 1 shows the process of creating an image cache.

Figure 1 Image cache creation process

Prerequisites

  • A CCE Autopilot cluster is available and meets the following conditions:
    • The cluster version must be v1.28.8, v1.31.4 or later. If your cluster version does not meet the requirements, you need to upgrade the cluster. For details about how to upgrade a cluster, see Upgrade Overview.
    • If the images need to be pulled from the SWR image center, VPC endpoints for accessing SWR and OBS must be configured for the cluster in advance. You can go to the Overview page of the cluster and check whether VPC endpoints have been configured for Image Access in the Networking Configuration area. If no VPC endpoint is configured for the cluster, configure one by following the instructions in Configuring a VPC Endpoint for Accessing the Image Center.
    • If the images need to be pulled over the public network, you need to configure SNAT rules on the NAT Gateway for the cluster in advance. You can go to the Overview page of the cluster and check whether SNAT rules have been configured for Internet Access (SNAT) in the Networking Configuration area. If no SNAT rules have been configured for the cluster, configure them by referring to Accessing the Public Network from a Container.
  • If third-party images are used, you need to provide the address, username, and password of the private image repository for creating a secret. You can create a third-party image secret in the cluster in advance, or create a secret as prompted when creating an image cache.

Constraints

  • You can create up to 50 image caches, and each image cache can contain a maximum of 20 container images. Images are downloaded in serial mode. If any selected image fails to be downloaded, the image cache creation fails.
  • After an image cache is created, it can only be used by CCE Autopilot clusters of v1.28.8, v1.31.4, or later in the current region. If the cluster version does not meet the requirements, you need to upgrade the cluster. For details about cluster upgrades, see Upgrade Overview.

Billing

Operation Phase

Billed Item

Billing Description

Reference

Creating an image cache

Pod

Pod billing is involved. During the creation of an image cache, a temporary pod is required to pull the container images. The pod specifications are as follows:

  • 2 vCPUs
  • 4-GiB memory
  • Storage (image cache): The storage capacity is the same as the image cache size.

After the image cache is created, the pod is automatically cleared, and the billing stops. ↵

For details about pod price, see Billing Items of CCE Autopilot Clusters. ↵

Procedure

  1. Log in to the CCE console. In the navigation pane, choose Cache Images. On the displayed page, click Create Cache Image.
  2. Configure the basic information. For details about the parameters, see Figure 1 and Table 1.

    Figure 2 Basic information about the image cache

    Table 1 Basic information about the image cache

    Parameter

    Example Value

    Description

    Image Cache Name

    autopilot-test

    Enter a unique name for the image cache.

    The name can contain 1 to 128 characters and must start and end with a lowercase letter or digit. Only lowercase letters, digits, hyphens (-), and periods (.) are allowed.

    Container Image

    Image Name: Click Select Container Image, select Open Source Images, and select nginx.

    Image Tag: latest

    If there are more than one container images, you can click Add to add more container images. Each image cache can contain a maximum of 20 container images.

    Image Name

    • If you want to use a third-party image, enter an image path.
    • If you do not need to use a third-party image, click Select Container Image.
      • My Images: You can select images in the SWR image repository of the current region.
      • Open Source Images: You can select public images.
      • Shared Images: You can select images shared by other users in the SWR image repository.

    Image Tag: After the images are selected, you need to select the image tag.

    Image Cache Size

    20GiB

    Enter a value from 20 to 400, in GiB. The default value is 20.

    Decompressed images are stored as cached objects. The space used depends on the image compression ratio. The image cache size should be at least three times the size of the images. If the image cache size is less than the size of the decompressed images, the image cache may fail to be created.

    Image Cache Retention Period

    60 days

    Set the retention period of image cache, in days. After an image cache expires, it will be deleted. The expiration of an image cache has no impact on the workloads created using the image cache.

    • All: default value
    • Custom: You can specify the retention period. The value ranges from 1 to 10000.

  3. Specify image cache settings. For details about the parameters, see Figure 3 and Table 2.

    Figure 3 Image cache settings

    Table 2 Image cache settings

    Parameter

    Example Value

    Description

    Cluster

    ap-test1

    Select the CCE Autopilot cluster where a temporary pod will be created for pulling images. To cache images, you need to pull the container images to the local host in advance. CCE Autopilot automatically creates a temporary pod in the specified cluster to pull these images.

    Namespace for Image Access Credential

    default

    Select an existing namespace or click Create Namespace to create one. For details about the parameters, see Creating a Namespace.

    After a namespace is specified, only secrets in this namespace can be used as image access credentials.

    Image Access Credential

    default-secret

    Credential for pulling images. A maximum of 20 credentials can be added.

    • If SWR images are used, select default-secret.
    • If public images are used, you do not need to select a secret.
    • If third-party images are used, select them from the private repository. If no credentials are available, click Create Secret. Only kubernetes.io/dockerconfigjson is supported. For details about the parameters, see Using Third-Party Images.

  4. Confirming the image cache settings and click Create.

    If the image cache status changes to Available in the image cache list, the image cache is created. After the image cache is created, it takes some time to synchronize the image cache before you can use it. The synchronization time varies depending on the cluster.