Updated on 2025-08-12 GMT+08:00

Configuring a Header for Images

Scenario

When an image is being pulled, the cci.io/registry-headers annotation can be used to configure the registry and header and provide more information about the image.

How to Use

When creating a pod, cci.io/registry-headers: "[{\"registry\":\"swr.cn-north-4.myhuaweicloud.com\",\"headers\":{\"key1\":\"value1\",\"key2\":\"value2\"}},{\"registry\":\"swr.cn-north-8.myhuaweicloud.com\",\"headers\":{\"key1\":\"value1\",\"key2\":\"value2\"}}]" can be added to the annotations field to configure the registries and headers for the container in the pod.

Constraints

  • The registry and header in the cci.io/registry-headers field in the request must be verified.
  • The cci.io/registry-headers field in the request is obtained from annotations.

Creating a Pod Using ccictl

You can add an annotation to the workload to control whether to configure the registry and header for a pod.

apiVersion: cci/v2
kind: Deployment
metadata:
  annotations:
    description: ''
  labels: {}
  name: nginx
spec:
  replicas: 2
  selector:
    matchLabels:
      app: nginx
  template:
    metadata:
      annotations:
        vm.cci.io/pod-size-specs: 2.00_4.0
        resource.cci.io/pod-size-specs: 2.00_4.0
        metrics.alpha.kubernetes.io/custom-endpoints: '[{api:'''',path:'''',port:'''',names:''''}]'
        cci.io/registry-headers: "[{\"registry\":\"{Image repository address}\",\"headers\":{\"key1\":\"value1\",\"key2\":\"value2\"}},{\"registry\":\"{Image repository address}\",\"headers\":{\"key1\":\"value1\",\"key2\":\"value2\"}}]"     # Enable registry-headers.
        log.stdoutcollection.kubernetes.io: '{"collectionContainers": ["container-0"]}'
      labels:
        app: nginx
    spec:
      containers:
        - image: library/nginx:stable-alpine-perl
          name: container-0
          resources:
            limits:
              cpu: 2000m
              memory: 4096Mi
            requests:
              cpu: 2000m
              memory: 4096Mi
          command: []
          lifecycle: {}
      dnsPolicy: ''
      imagePullSecrets:
        - name: imagepull-secret
      dnsConfig: {}
  minReadySeconds: 0
  strategy:
    type: RollingUpdate
    rollingUpdate:
      maxSurge: 0
      maxUnavailable: 1

cci.io/registry-headers indicates that the registry and header will be configured for the pod.