Using Image Snapshots to Accelerate Image Pull
Scenario
Image snapshots provide a more efficient way to start up containers. Using an image snapshot to create a pod accelerates image pull and reduces the time required for starting up the containers. For details about how to use image snapshots, see Using Image Snapshots.
Procedure
- Log in to the CCI 2.0 console. In the navigation pane, choose Image Snapshots. On the displayed page, click Create from YAML. The following is an example YAML file:
apiVersion: cci/v2 kind: ImageSnapshot metadata: name: imagesnapshot-a spec: buildingConfig: namespace: default # Namespace imageSnapshotSize: 20 # Image snapshot size, in GiB ttlDaysAfterCreated: 100 # Image validity period images: - image: nginx:stable-alpine-perl # Image registries: []
- In the navigation pane, choose Workloads. On the Deployments tab, click Create from YAML to create a workload. Add cci.io/image-snapshot-auto-match: 'true' in annotations. The following is an example:
kind: Deployment apiVersion: cci/v2 metadata: name: nginx spec: replicas: 1 selector: matchLabels: app: nginx template: metadata: labels: app: nginx annotations: cci.io/image-snapshot-auto-match: 'true' # Automatic matching of image snapshots spec: containers: - name: nginx image: nginx:stable-alpine-perl resources: requests: cpu: 500m memory: 1Gi
- Verify that the pod annotations contain the cci.io/image-snapshot-detail and cci.io/imagesnapshot-volume fields, the matched image snapshot is displayed, and the size of the mounted data disk is the same as that of the image snapshot.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot