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

相关推荐
懒鸟一枚28 分钟前
k8s 之minikube安装看k8s
云原生·容器·kubernetes
qq_4557608513 小时前
docker - 镜像、存储卷和网络深入理解
运维·docker·容器
木童66216 小时前
Ruo-Yi 项目 CICD 完整部署文档(含命令详解)
ci/cd·docker·容器
幺零九零零17 小时前
Docker底层- 命令详解
运维·docker·容器
庸子18 小时前
Kubernetes 可观测性实战:解构 Prometheus + Grafana 企业级监控架构
kubernetes·grafana·prometheus
Ama_tor18 小时前
docker|F盘安装の1键部署软件及数据储存+2个保姆级运行实例
运维·docker·容器
invicinble20 小时前
对于docker在项目中的完整实战
运维·docker·容器
庸子20 小时前
告别手动运维:Kustomize 与 ArgoCD 构建的 GitOps 体系
运维·kubernetes·argocd
❀͜͡傀儡师21 小时前
Docker快速部署一个轻量级邮件发送 API 服务
jvm·docker·容器
深耕AI21 小时前
Docker Volumes详解
运维·docker·容器