During container creation, image pulling often takes a long time. To address this problem, you can use the automatic image caching solution to accelerate VCI creation.
Usage limits
The following limits apply when you use the automatic image caching solution to accelerate VCI creation.
Procedure
Step 1: Prepare a container image
Prepare the container image to be used for creating a VCI. You can use images from Volcano Engine CR as well as images from third-party container registries.
Step 2: (Optional) Automatically cache and warm up the image
Before creating a VCI, confirm whether the container image to be used is a new image. If it is a new image, you need to add the image to the cache and warm it up in advance.
tip
A new image refers to a container image whose image name, image tag, image layer data, and other attributes are different from those of existing images.
Using the console
Using YAML
- Create a Deployment. When you create the Deployment, configure some parameters as described below.
- a. Basic information: Select Volcengine Container Instance for the Computing power type parameter.
- b. Container configuration: Select the prepared new image.
- c. Advanced settings: In the Instance annotation field, add the following annotation: vci.vke.volcengine.com/enable-auto-create-imc:"true".
warning
By default, VCI provides only 40 GiB of storage space for an image cache. If a larger cache capacity is required for the target container image, you need to add an additional annotation in this step: vci.vke.volcengine.com/auto-imc-disk-size: "specific capacity size (GiB)" to specify the required image cache disk size. For example, if 80 GiB is needed, also add the vci.vke.volcengine.com/auto-imc-disk-size: "80" annotation.
- Click Confirm to create the VCI Deployment.
- Create a YAML file for the VCI Deployment. The following vci-deployment.yaml file serves as an example:
- Run the following command to create the VCI Deployment.
Step 3: Confirm image cache availability
Use the OpenAPI interface ListImageCaches to query all image cache files that belong to the current Volcano Engine root user. warning
An automatically created image cache can be properly matched and used to create VCIs only when its status is [Ready.Ok].
Step 4: Accelerate VCI creation with automatic image caching
After confirming that the target image cache is available, you can use it to create a large number of VCI pods. You can use the following methods:
tip
- To ensure that a VCI created using an image cache can function normally, manually specify the system disk size by adding a pod annotation when creating the VCI. This practice helps ensure enough space for storing the image cache and deploying VCI system components. For more information, see Pod annotations.
- The annotation key is vci.vke.volcengine.com/desired-system-storage, and the annotation value should be set according to the following principles:
- Automatic image cache matching: Image size × 2 to image size × 2.5. For example, if the image size selected for VCI creation is 20 GiB, you need to specify a system volume size of 40 GiB to 50 GiB.
- Manually specified image cache: Image cache size + 20 GiB. For example, if your image cache size is 60 GiB, you need to specify a system volume size of 80 GiB.
- The capability of manually specifying the system disk volume is in beta. To use this capability, submit an application.
Automatically matching image caches
Manually matching image caches
When creating a VCI, select an image that has already been automatically cached. For details, see Creating instances. The system automatically matches the optimal image cache based on the matching strategy to create VCIs. For the strategy of automatically matching image caches, see Using image caches. tip
If you have not performed Step 2, you need to add the vci.vke.volcengine.com/enable-auto-create-imc:"true" annotation to the spec·template·metadata of the VCI to enable automatic image caching. Add the vci.vke.volcengine.com/image-cache-id:imc-3uqroqkx0i3j******** annotation to the spec·template·metadata of the VCI to specify the image cache ID. For details, see Creating instances. The specified image cache will be used to create the VCI.
warning
VCI performs pre-checks on the status of the image cache specified by vci.vke.volcengine.com/image-cache-id. Ensure the specified image cache is in [Ready.Ok] state. Otherwise, an error will occur and the VCI pod cannot be created.
Related documentation