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

相关推荐
名字还没想好☜3 分钟前
Docker 网络实战:bridge/host/none/自定义网络、容器互通与端口映射踩坑
运维·docker·kubernetes
探索云原生2 小时前
KubeClipper 1.7.0 发布:Operation 优化与 Kubernetes 1.37 支持
linux·docker·云原生·kubernetes·go
fengkai45454 小时前
八、Docker详解1-3
运维·docker·容器
MrSYJ6 小时前
Veth pair 细讲
docker·云原生·容器
秦jh_7 小时前
【Docker】容器
运维·docker·容器
Eminem899 小时前
11、k8s控制器Replicaset
k8s
天天喝旺仔9 小时前
Prometheus + Grafana 监控告警体系搭建实战:从 Exporter 指标采集、PromQL 查询到 Alertmanager 告警落地
容器·kubernetes·grafana·prometheus·时序数据库
大盛供应链·卢生19 小时前
哪些国产芯片可以替代进口芯片,哪些替代不了
fpga开发·容器
Mr小林1 天前
Docker 安装教程(在线 + 离线)
运维·docker·容器
wdfk_prog1 天前
VMware Ubuntu 虚拟机从 124 GB 压缩到 33 GB
运维·缓存·docker·容器