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

相关推荐
Qayrup1 天前
docker 搭建私有仓库,推送并拉取
运维·docker·容器
黑黍1 天前
如何在k8s中配置并使用nvidia显卡
云原生·容器·kubernetes
冷血~多好1 天前
使用docker部署elk,实现日志追踪
elk·docker·容器
会飞的小蛮猪1 天前
SkyWalking运维之路(Java探针接入)
java·运维·经验分享·容器·skywalking
天一生水water1 天前
docker-compose安装
运维·docker·容器
蓝象_1 天前
docker安装配置mysql
mysql·docker·容器
Cxzzzzzzzzzz1 天前
Kubernetes 架构
容器·架构·kubernetes
return(b,a%b);1 天前
docker拉取失败,更换docker的源
docker·容器·eureka
时鲟、时倾1 天前
docker部署kafka
docker·容器·kafka
byte轻骑兵1 天前
WSL+openEuler云原生实践:Docker全流程部署与多容器编排深度评测
docker·云原生·容器·openeuler