Images
You can manage images using SWR. This section describes how images are pulled when the CCE Cloud Bursting Engine for CCI add-on is installed in a CCE cluster.
Pulling an Image from SWR on the Console
- Method 1: Selecting an Image from SWR on the CCE Console
- Upload an image to SWR. For details, see the SWR documentation.
- Create a workload on the CCE cluster console and select an image.
- The image will be pulled from SWR. Ensure that your image has been pushed to SWR. For details, see the SWR documentation.
- Method 2: Select an SWR Image by Configuring a Node in a CCE Cluster
- View the image path in the SWR image repository, for example, swr.cn-north-4.myhuaweicloud.com/cci-test/nginx:1.0.0.x86_64_test.
cn-north-4 indicates the region, and cci-test is the SWR organization.
- Log in to a CCE cluster node.
- Configure the YAML file of the workload.
apiVersion: apps/v1 kind: Deployment metadata: name: test namespace: default labels: bursting.cci.io/burst-to-cci: enforce # Schedules the workload to CCI 2.0. spec: replicas: 2 selector: matchLabels: app: test template: metadata: labels: app: test spec: containers: - image: swr.***.com/cci-test/nginx:1.0.0.x86_64_test name: container-0 resources: requests: cpu: 250m memory: 512Mi limits: cpu: 250m memory: 512Mi volumeMounts: [] imagePullSecrets: - name: default-secret
- Deploy the workload.
kubectl apply -f test-deployment.yaml
- View the image path in the SWR image repository, for example, swr.cn-north-4.myhuaweicloud.com/cci-test/nginx:1.0.0.x86_64_test.
Using Both SWR and a Third-Party Image Repository
Scenario
In some cases, an image can be pulled from a third-party image repository when you create a workload on the CCE cluster console. The pulled image can be synchronized to SWR so that the workload scheduled to CCI uses the image during traffic spikes. This speeds up image pull.
Procedure
Configure annotations in the YAML file of the workload. The following is an example:
bursting.cci.io/image-replacement: '[ {"repositoryPrefix":"harbor.domain","replaceWith":"swr.***.com/org1"}, {"repositoryPrefix":"","replaceWith":"swr.***.com/org1"}, {"repositoryPrefix":"harbor.domain/a/b/c/d","replaceWith":"swr.***.com/org2"} ]'

- Replacement policies can be executed in any sequence.
- Multiple replacement policies can be configured. The value of repositoryPrefix for each policy must be unique.
Replacement Policy Key |
Description |
Remarks |
---|---|---|
repositoryPrefix |
Image prefix that you want to match and replace. |
|
replaceWith |
Image prefix to be used. |
|
Annotation |
Before Replacement |
After Replacement |
Description |
---|---|---|---|
bursting.cci.io/image-replacement: '[ {"repositoryPrefix":"harbor.domain","replaceWith":"swr.***.com/org1"} ]' |
containers: - name: container-0 image: 'harbor.domain/ubuntu:latest' |
containers: - name: container-0 image: 'swr.***.com/org1/ubuntu:latest' |
repositoryPrefix matches the domain name of a third-party repository. |
bursting.cci.io/image-replacement: '[ {"repositoryPrefix":"","replaceWith":"swr.***.com/org1"} ]' |
containers: - name: container-1 image: 'nginx:latest' |
containers: - name: container-1 image: 'swr.***.com/org1/nginx:latest' |
repositoryPrefix is left empty. |
bursting.cci.io/image-replacement: '[ {"repositoryPrefix":"harbor.domain/a/b/c/d","replaceWith":"swr.***.com/org2"} ]' |
containers: - name: container-2 image: 'harbor.domain/a/b/c/d/redis:latest' |
containers: - name: container-2 image: 'swr.***.com/org2/redis:latest' |
repositoryPrefix matches the domain name of a third-party repository and the organization directory. |
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