k8s containerd 配置 http访问harbor image【最新--官方文档】

不看官方文档的代价:在搜索了很多中文资料发现配置了都不起作用,浪费了很多时间。

https://github.com/containerd/containerd/blob/main/docs/cri/config.md#registry-configuration

The old CRI config pattern for specifying registry.mirrors and registry.configs has been DEPRECATED. You should now point your registry config_path to the path where your hosts.toml files are located. 也就是说直接在/etc/containerd/config.toml里配置 registry.mirrors已经失效了。

最新的配置方法是只在config.toml 中指定hosts.toml的config_path

plugins."io.containerd.grpc.v1.cri".registry

config_path = "/etc/containerd/certs.d"

在hosts.toml配置真正的harbor的URL, 默认是https,这里改成了http

vim /etc/containerd/certs.d/registry.imagehub.com/hosts.toml

server = "http://registry.imagehub.com"

host."http://registry.imagehub.com"

capabilities = ["pull", "resolve", "push"]

skip_verify = true

修改完,需要daemon-reload, restart containerd

验证pull image是否成功:

ctr images pull --hosts-dir "/etc/containerd/certs.d" registry.imagehub.com/library/hello_world:v2

网元yaml配置image地址:

cat hello_world.yaml

containers:

  • name: hello-world-container

image: registry.imagehub.com/library/hello_world:v2

kubectl get pods --all-namespaces

NAMESPACE NAME READY STATUS RESTARTS AGE

default hello-world-6c8d6fb999-8fdsd 1/1 Running 0 52m

相关推荐
Brandon汐9 小时前
LVS+Keepalived 双主架构全规划(LVS→HAProxy→Web)
容器·架构·lvs
Doker 多克9 小时前
Kubernetes 之Deployments
kubernetes
hyunbar10 小时前
Docker命令及使用指南
运维·docker·容器
yuweiade13 小时前
docker desktop安装redis
redis·docker·容器
huabiangaozhi14 小时前
Docker:基于自制openjdk8镜像 or 官方openjdk8镜像,制作tomcat镜像
docker·容器·tomcat
人间打气筒(Ada)14 小时前
「码动四季·开源同行」docker容器单机编排docker-compose
运维·docker·容器·docker-compose·容器编排·批量·docker compose
小学鸡!14 小时前
win10/win11下载安装Docker,Windows安装Docker Desktop 【保姆级教程】
windows·docker·容器
谁在黄金彼岸15 小时前
MariaDB Docker容器权限配置问题分析与解决方案
后端·docker·容器
笨手笨脚の15 小时前
k8s 中的一些小知识
云原生·容器·kubernetes
cyber_两只龙宝15 小时前
【Docker】Docker的原生网络介绍
linux·运维·docker·云原生·容器