Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Managed Threat Detection
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive

Images

Updated on 2024-10-29 GMT+08:00

Overview

You can manage images using SWR or a third-party image repository. 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
    1. Upload an image to SWR. For details, see the SWR documentation.
    1. Create a workload on the CCE cluster console and select an image.

    2. 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
    1. Log in to the CCE cluster node.
    2. View the image address in SWR.

      Image address: swr.***.com/cci-test/nginx:1.0.0.x86_64_test

    3. 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
    4. Deploy the workload.
      kubectl apply -f  dep.yaml

Pulling an Image from a Third-Party Image Repository

  1. Use the tool provided by CCI to create a secret for authenticating the third-party image repository.
    imagepull-secret-generator --ak=$ak --sk=$sk --private-user=$user --private-password=$password --output-file-path=my-imagepull-secret.json --project-name=region --secret-name=my-imagepull-secret --swr-address=swr.***.com
    Log in to the CCE cluster node and create a secret for the cluster.
    kubectl apply -f my-imagepull-secret.json
  2. Create a workload and specify the secret for authenticating the third-party image repository in spec.imagePullSecrets.

    Create a workload and specify the secret for authenticating the third-party image repository in spec.imagePullSecrets.

    apiVersion: apps/v1
    kind: Deployment
    metadata:
      labels:
        app: test-imagepull
        virtual-kubelet.io/burst-to-cci: enforce
      name: test-imagepull
    spec:
      replicas: 1
      selector:
        matchLabels:
          app: test-imagepull
      template:
        metadata:
          labels:
            app: test-imagepull
        spec:
          containers:
          - image: xxx/my-image:latest
            imagePullPolicy: Always
            name: nginx
            resources:
              limits:
                cpu: 1
                memory: 2Gi
              requests:
                cpu: 1
                memory: 2Gi
          imagePullSecrets:
          - name: my-imagepull-secret

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"}
]'
NOTE:
  • 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.

  • If this field is left empty, all containers whose image values do not contain slashes (/) are matched.
  • If this field is not empty, all containers whose image values have the same prefix and end with slashes (/) are matched.
  • This field cannot end with a slash (/) and is verified the same as the container image name.

replaceWith

Image prefix to be used.

  • The value of this field cannot be the same as that of repositoryPrefix.
  • This field cannot end with a slash (/) and is verified the same as the container image name.
Table 1 Annotations

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.

We use cookies to improve our site and your experience. By continuing to browse our site you accept our cookie policy. Find out more

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback