k8s 使用 containerd 运行时配置 http 私服

Kubernetes 从 v1.20 开始弃用 Docker,并推荐用户切换到基于容器运行时接口(CRI)的容器引擎,如 containerd、cri-o 等。
目前使用的环境中使用了 Kubernetes v1.22.3,containerd 1.4.3,containerd 在配置私服配置上与直接使用 docker 有一定区别。
今天简单聊一下如何配置私服,默认使用 dockerhub 官方镜像 registry:v2harbor 配置的私服为 http,未做配置时 k8s 拉镜像时会以 https 协议访问。
假定已创建好的私服地址为 http://10.211.55.2:5000,进行如下修改
编辑 worker 节点上 /etc/containerd/config.toml,查找plugins."io.containerd.grpc.v1.cri".registry.mirrors配置
相关配置中调整为如下内容

[plugins."io.containerd.grpc.v1.cri".registry]
      [plugins."io.containerd.grpc.v1.cri".registry.mirrors]
        [plugins."io.containerd.grpc.v1.cri".registry.mirrors."docker.io"]
          endpoint = ["https://registry.cn-hangzhou.aliyuncs.com"]
        [plugins."io.containerd.grpc.v1.cri".registry.mirrors."192.168.210.114:5000"]
          endpoint = ["http://192.168.210.114:5000"]

参考 [plugins."io.containerd.grpc.v1.cri".registry.mirrors."10.211.55.2:5000"] 行添加私服配置,使用该配置可以直接配置相关 endpoint 为 http 地址。

重启 containerd,使配置生效

systemctl restart containerd

这时候,使用 crictl pull 命令就可以获取 http 协议私服上的镜像了

crictl pull 192.168.210.114:5000/cuda-vector-add:v0.1
Image is up to date for sha256:57146f1c77885852bbee6961a207701b4230574e9d33f8272ea8d534ea22b3a1

  • 3
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

0X码上链

你的鼓将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值