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

相关推荐
小的博客6 分钟前
windows下安装Docker Desptop
运维·docker·容器
Zhu75836 分钟前
在k8s环境部署Apache zookeeper3.9.5,高可用,多pod
容器·kubernetes·apache
雨声不在1 小时前
macos 12使用docker
macos·docker·容器
运维大师2 小时前
【K8S 运维实战】07-Pod生命周期与故障排查
运维·容器·kubernetes
BullSmall17 小时前
Anolis OS 8.10 完整安装 Docker CE(生产可用,解决 podman 冲突)
docker·容器·podman
heimeiyingwang18 小时前
【架构实战】可观测性三支柱:日志、指标、链路的融合
elasticsearch·架构·kubernetes
CodexDave1 天前
数据库连接池耗尽:排查顺序与三层兜底
服务器·前端·数据库·git·云原生·容器·kubernetes
java_logo1 天前
ELK Docker Compose 部署指南:轻松搭建日志检索平台
elk·elasticsearch·docker·容器·kibana·logstash·轩辕镜像
ShallWeL1 天前
Orin 上用 Docker 跑通目标检测功能
人工智能·目标检测·docker·容器
辰同学ovo1 天前
用“舞台换景”讲清 Docker 的 Restart 与 Recreate
运维·docker·容器