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

Creating an Image Snapshot

Scenarios

This section describes how you can create an image snapshot. For details about how image snapshots work, see Overview.

Procedure

To run a container, you need to pull the specified container image first. However, due to factors such as the network and container image size, the pod startup speed slows down by image pull. You can create a snapshot using the image to be used. Then, you can use the snapshot to create pods without pulling the images, speeding up pod startup.

  1. Log in to the CCI 2.0 console.
  2. In the navigation pane, choose Image Snapshots.
  3. Click Create from YAML in the upper right corner.

    The following example creates an image snapshot named my-imagesnapshot.

    apiVersion: cci/v2
    kind: ImageSnapshot
    metadata:
      name: 'my-imagesnapshot'
    spec:
      buildingConfig:
        namespace: test-namespace
        eipID: xxxxxxxx
      imageSnapshotSize: 30
      ttlDaysAfterCreated: 7
      images:
        - image: 'nginx:stable-alpine-perl'
      registries:
        - imagePullSecret: imagepull-secret
          server: xxxxx.myhuaweicloud.com
          plainHTTP: true
    Table 1 Parameter description

    Field

    Type

    Mandatory

    Example Value

    Description

    .metadata.name

    String

    Yes

    my-imagesnapshot

    Image snapshot name.

    .spec.images.image

    String

    Yes

    nginx:latest

    Image used to create an image snapshot.

    .spec.registries.server

    String

    Yes

    serverA.com

    Image repository address without the http:// or https:// prefix.

    .spec.registries.imagePullSecret

    String

    No

    imagepull-secret

    Secret for accessing the image repository.

    .spec.registries.plainHTTP

    boolean

    No

    true

    If the self-managed image repository address uses the HTTP protocol, set the value to true, or the image fails to be pulled due to different protocols. The default value is false.

    .spec.registries.insecureSkipVerify

    boolean

    No

    true

    If the self-managed image repository address uses a self-issued certificate, set the value to true to skip certificate authentication, or the image fails to be pulled due to certificate authentication failure. The default value is false.

    .spec.buildingConfig.namespace

    String

    Yes

    my-namespace-a

    User namespace. During image snapshot creation, you need to create a pod in the user namespace.

    .spec.buildingConfig.eipID

    String

    No

    3cxxxxe0-xxxx-xxxx-xxxx-8xxxxf3xxxx4

    EIP used for pulling images from the public network.

    .spec.buildingConfig.autoCreateEIP

    boolean

    No

    true

    Whether to automatically assign an EIP for the pod that will create the image snapshot. If eipId is specified, this parameter is ignored. If this parameter is set to true, you need to specify the EIP configuration using autoCreateEIPAttribute.

    .spec.buildingConfig.autoCreateEIPAttribute.bandwidthChargeMode

    String

    No

    bandwidth

    Whether the billing is based on traffic or bandwidth.

    The value can be traffic or bandwidth. If this parameter is left blank or is an empty string, default value bandwidth is used. For IPv6 addresses, the default parameter value is bandwidth outside China and is traffic in China.

    .spec.buildingConfig.autoCreateEIPAttribute.bandwidthSize

    int

    No

    1000

    Bandwidth size.

    The value ranges from 1 Mbit/s to 2,000 Mbit/s by default.

    .spec.buildingConfig.autoCreateEIPAttribute.type

    String

    No

    5_bgp

    EIP type.

    The value can be 5_bgp (dynamic BGP), 5_sbgp (static BGP), or 5_youxuanbgp (premium BGP).

    .spec.buildingConfig.autoCreateEIPAttribute.ipVersion

    int

    No

    4

    EIP version.

    The value can be 4 or 6.

    • 4 indicates IPv4. If this parameter is left empty or is an empty string, an IPv4 address is assigned by default.
    • 6 indicates IPv6. If the parameter is set to 6, NAT64 is enabled.

    .spec.buildingConfig.TimeoutMinutes

    int

    No

    1440

    Timeout interval for creating a snapshot, in minutes.

    The value is an integer from 30 to 10,080 (which is one week). The default value is 1440, which is one day.

    .spec.ttlDaysAfterCreated

    integer

    No

    10

    Retention period of the image snapshot, in days. Expired image snapshots will be deleted. The default value is 0, indicating that the image snapshot never expires.

    When an image snapshot is used by a workload or pod, its expiration time is reset to the time when the image snapshot is used plus the image snapshot retention period.

    NOTE:

    After an image snapshot expires, it still occupies the quota. You need to periodically review and delete expired image snapshots.

    .spec.imageSnapshotSize

    integer

    No

    20

    Image snapshot size, in GiB. The default value is 20.