Images
Overview
You can manage images using SWR. This section describes how images are pulled when the bursting 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: Selecting an Image from SWR Using YAML
- Log in to the CCE cluster node.
- View the image address in SWR.
- Configure the YAML file of the workload.
apiVersion: apps/v1 kind: Deployment metadata: name: test namespace: default labels: virtual-kubelet.io/burst-to-cci: 'auto' # Schedules the workload to CCI. 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 dep.yaml
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 workloads scheduled to CCI use 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:
"coordinator.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 |
---|---|---|---|
"coordinator.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. |
"coordinator.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. |
"coordinator.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