使用自建镜像仓库 |
您所在的位置:网站首页 › 阿里云ack集群如何拉取私有镜像 › 使用自建镜像仓库 |
配置说明 拉取自建镜像仓库中的镜像时,如果镜像仓库采用HTTP协议,或者使用自签发证书,需配置Annotation来避免镜像拉取失败。相关Annotation说明如下: 配置项 示例值 说明 k8s.aliyun.com/plain-http-registry "harbor***.pre.com,192.168.XX.XX:5000,reg***.test.com:80" 取值为自建镜像仓库地址。 拉取采用HTTP协议的自建镜像仓库中的镜像时,需配置该参数,使得ECI使用HTTP协议拉取镜像,避免因协议不同而导致镜像拉取失败。 k8s.aliyun.com/insecure-registry "harbor***.pre.com,192.168.XX.XX:5000,reg***.test.com:80" 取值为自建镜像仓库地址。 拉取使用自签发证书的自建镜像仓库中的镜像时,需配置该参数来跳过证书认证,避免因证书认证失败而导致镜像拉取失败。 说明如果有多个容器的镜像需要从不同的镜像仓库中拉取,支持填写多个镜像仓库地址,各个地址之间采用半角逗号隔开,例如harbor***.pre.com,192.168.XX.XX。 如果镜像仓库地址有端口号,则需要带上端口号,例如:镜像地址为192.168.XX.XX:5000/nginx:latest,则Annotation的值需设置为192.168.XX.XX:5000。 拉取自建镜像仓库中的镜像创建ECI Pod配置时,Annotation请添加在Pod的metadata下,例如配置Deployment时,Annotation需添加在spec>template>metadata下。 配置示例如下: 示例一:自建镜像仓库采用HTTP协议 apiVersion: apps/v1 kind: Deployment metadata: name: nginx labels: app: nginx spec: replicas: 4 selector: matchLabels: app: nginx template: metadata: name: nginx-test annotations: k8s.aliyun.com/plain-http-registry: "192.168.XX.XX:5000" labels: app: nginx alibabacloud.com/eci: "true" spec: containers: - name: nginx image: 192.168.XX.XX:5000/test/nginx:latest示例二:自建镜像仓库使用自签发证书 apiVersion: apps/v1 kind: Deployment metadata: name: nginx labels: app: nginx spec: replicas: 4 selector: matchLabels: app: nginx template: metadata: name: nginx-test annotations: k8s.aliyun.com/insecure-registry: "harbor***.pre.com" labels: app: nginx alibabacloud.com/eci: "true" spec: containers: - name: nginx image: harbor***.pre.com/test/nginx:latest拉取自建镜像仓库中的镜像创建ImageCache配置时,Annotation请添加在ImageCache的metadata下,配置示例如下: 示例一:自建镜像仓库采用HTTP协议 apiVersion: eci.alibabacloud.com/v1 kind: ImageCache metadata: name: imagecache-sample annotations: k8s.aliyun.com/plain-http-registry: "192.168.XX.XX:5000" #指定自建镜像仓库地址,使用HTTP协议拉取镜像 spec: images: - 192.168.XX.XX:5000/test/nginx:latest imagePullSecrets: - default:secret1 - default:secret2 - kube-system:secret3 imageCacheSize: 25 retentionDays: 7示例二:自建镜像仓库使用自签发证书 apiVersion: eci.alibabacloud.com/v1 kind: ImageCache metadata: name: imagecache-sample annotations: k8s.aliyun.com/insecure-registry: "harbor***.pre.com" #指定自建镜像仓库地址,拉取镜像时跳过正式认证 spec: images: - harbor***.pre.com/test/nginx:latest imagePullSecrets: - default:secret1 - default:secret2 - kube-system:secret3 imageCacheSize: 25 retentionDays: 7 |
今日新闻 |
推荐新闻 |
CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3 |