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

相关推荐
真上帝的左手19 小时前
十一、容器化 vs 虚拟化-Kubernetes(K8s)
云原生·容器·kubernetes
落日漫游19 小时前
K8s ConfigMap配置管理全解析
云原生·容器·kubernetes
我真的是大笨蛋19 小时前
K8S-Pod(下)
java·笔记·云原生·容器·kubernetes
一个天蝎座 白勺 程序猿21 小时前
Python爬虫(47)Python异步爬虫与K8S弹性伸缩:构建百万级并发数据采集引擎
爬虫·python·kubernetes
紫金修道21 小时前
k8s的容器操作指令
云原生·容器·kubernetes
方渐鸿21 小时前
【2024】k8s集群 图文详细 部署安装使用(两万字)
java·运维·容器·kubernetes·k8s·运维开发·持续部署
喝杯白开水!21 小时前
K8s中的控制器DaemonSet、StatefulSet、Job、CronJob、Server发现、健康检查、存储卷(PV),相关知识总结
云原生·容器·kubernetes
晓衣21 小时前
2025“獬豸杯”全国电子数据取证竞赛-k8s服务器取证wp
服务器·经验分享·程序人生·网络安全·容器·kubernetes·学习方法
学亮编程手记21 小时前
K8S v1.33 版本主要新特性介绍
java·容器·kubernetes
我爱云计算21 小时前
K8S详解(5万字详细教程)
linux·运维·云原生·容器·kubernetes