Updated on 2026-04-28 GMT+08:00

Configuring Automatic Image Snapshot Creation

In practice, manually creating image snapshots may increase O&M complexity. CCI supports automatic image snapshot creation to simplify operations. When an image is pulled, if no existing image snapshot matches the image, CCI automatically creates a new image snapshot. This reduces manual intervention and improves workload creation efficiency.

Procedure

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

    The following is an example:
    kind: Deployment
    apiVersion: cci/v2
    metadata:
      name: deploy-example
      namespace: test
    spec:
      replicas: 1
      selector:
        matchLabels:
          app: deploy-example
      template:
        metadata:
          labels:
            app: deploy-example
          annotations:
            cci.io/image-snapshot-create-if-not-present: 'true' # Automatic image snapshot creation is enabled.
        spec:
          containers:
            - name: deploy-example
              image: nginx:latest
              resources:
                limits:
                  cpu: '1'
                  memory: 2G
                requests:
                  cpu: '1'
                  memory: 2G
              terminationMessagePath: /dev/termination-log
              terminationMessagePolicy: File
          restartPolicy: Always
          terminationGracePeriodSeconds: 30
          dnsPolicy: Default
          securityContext: {}
          imagePullSecrets:
            - name: imagepull-secret
          schedulerName: default-scheduler
      strategy:
        type: RollingUpdate
        rollingUpdate:
          maxUnavailable: 25%
          maxSurge: 100%
      progressDeadlineSeconds: 600
    Table 1 Parameters for configuring automatic image snapshot creation

    Parameter

    Type

    Description

    cci.io/image-snapshot-create-if-not-present

    String

    Whether to enable automatic image snapshot creation. If this parameter is not configured, automatic image snapshot creation is disabled by default. Even if there is no image snapshot, no image snapshot will be automatically created. If there is an image snapshot, this image snapshot will be used.

    true: Automatic image snapshot creation is enabled. If there is no image snapshot, an image snapshot will be automatically created. If there is an image snapshot, this image snapshot will be used.

    • If a pod uses multiple images and any image matches an existing image snapshot, CCI will use the matched image snapshot and does not automatically create a new image snapshot for the image.

  4. Check automatic image snapshot creation.

    Check the pod. If no image snapshot is matched, CCI automatically creates a temporary pod named cci-imagesnapshot-xxx to create an image snapshot.

    When the cci-imagesnapshot-xxx pod disappears, the image snapshot is created.

    When you add replicas, the new pod uses the automatically-created image snapshot. No additional operations are required.