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

相关推荐
Mr.王8355 小时前
Kubernetes宿主机本地盘池化管理
ceph·云原生·容器·kubernetes
Smoothcloud润云8 小时前
从“预测下一个词”到“预测下一个世界状态”:世界模型作为AGI新范式的深度分析报告
人工智能·测试工具·微服务·容器·github·状态模式·agi
老王熬夜敲代码10 小时前
接入Docker隔离测试
docker·容器·langchain
张32312 小时前
K8s存储卷入门
云原生·kubernetes
MGS浪疯13 小时前
让 QClaw 将复杂的 Docker 项目转为 exe!
运维·docker·容器
zhao006614 小时前
flux + kubernetes + gitops + Kustomization
kubernetes·gitops
.柒宇.14 小时前
docker容器技术实战
运维·docker·容器
倔强的胖蚂蚁14 小时前
信创企业级 openEuler 24 部署 docker-ce 全指南
运维·docker·云原生·容器
岳来16 小时前
docker network 创建 host 和 none 网络模式
网络·docker·容器·docker network
Strugglingler16 小时前
Docker入门
docker·容器