Accelerate ACS Windows pod startup using image caches
Create ACS pods with an image cache (ImageCache) to accelerate image pulls and reduce startup time for ACS Windows pods.
How it works
Before running a container, an ACS pod must pull the specified container image. However, factors such as network conditions and container image size often make image pulling the longest step in pod startup. To accelerate instance startup, ACS provides the ImageCache feature. By pre-creating an ImageCache from a container image, you can create ACS pods that use the cache. This avoids or reduces image layer downloads and shortens startup time.
The actual speed improvement depends on factors such as the size of the container image used by the ACS pod and the network connectivity to the image repository.
Each ImageCache can contain one image. An ImageCache with the In Progress status is being built. Once its status changes to Completed, it is ready for use.
The time required to create an ImageCache depends on the container image size and the configured network bandwidth. Creation may time out and fail due to issues such as network connectivity problems, authentication failure, or a non-existent repository or tag.
Limitations
ACS Windows pods do not support GPU image caches.
Create an image cache
The ACS console only supports creating linux/amd64 ImageCaches. To create a Windows ImageCache, use the OpenAPI and set the Platform parameter to windows/amd64.
OpenAPI
Use an image cache
Pod annotation | Description |
| Enables the ImageCache matching feature for the pod. |
After you enable this feature, the pod automatically matches and uses the optimal ImageCache based on the following criteria:
Image match: The ImageCache image name must exactly match the image specified in the pod.
Creation time: The most recent available ImageCache is preferred.
-
On the Clusters page, click the name of the target cluster. In the left-side navigation pane, choose Workloads > Pods, and then click Create from YAML.
-
Create a Windows pod with the following YAML. Add the
image.alibabacloud.com/enable-image-cache: "true"annotation to enable image cache matching.Ensure that the network configuration and access credentials allow access to the image repository. The only supported imagePullPolicy is
Always.apiVersion: v1 kind: Pod metadata: name: nanoserver annotations: image.alibabacloud.com/enable-image-cache: "true" labels: alibabacloud.com/acs: "true" spec: nodeSelector: kubernetes.io/os: windows containers: - name: nanoserver image: registry-cn-hangzhou.ack.aliyuncs.com/test/nanoserver:ltsc2022 command: ["ping", "-t", "localhost"] resources: requests: cpu: "4" memory: "8Gi" limits: cpu: "4" memory: "8Gi" -
After the pod is created, click its name to go to the Overview page. When the ImageCache matching feature is enabled, the system automatically adds an annotation with information about the matched ImageCache to the pod.
Feature
Parameter
Example value
Description
Image cache hit information
image.alibabacloud.com/matched-image-caches[{"imageCacheId":"imc-*****t15xuii6tz*****","size":1}]The ID and size (in GiB) of the hit image cache.
Related information
Accelerate ACS pod startup using image caches covers image cache precautions and billing.