本来想用 containerd 部署 k8s 来着,然后发现了点 containerd 强迫症的地方

52 天前
 miaosl

因为之前一次装 k8s 用的是 docker+cri 插件的方法,很简单,也很方便,但是当时也是稀里糊涂的按照网上搜到的教程装的,了解到 containerd 是原生支持 k8s 的不需要安装什么插件,所以我想试试 containerd 。

然后问题来了,因为我用的源里面实在是没有 containerd ,所以我挂代理用最新的官方源下载的,但是下载完了配置好国内加速镜像之后拉去的时候会提示,直接在配置文件里设置镜像加速这种方法将会在新的版本中废弃,现在是在配置文件中指定路径然后再路径中指定镜像源的信息。 [plugins."io.containerd.grpc.v1.cri".registry] config_path = "/etc/containerd/certs.d" 然后 ` [root@harbor containerd]# cat certs.d/hosts.toml server = "https://registry-1.docker.io"

[host."https://registry-1.docker.io"] capabilities = ["pull", "resolve"] [host."https://registry-1.docker.io".header] # Authorization = ["Basic <base64_encoded_auth>"] [host."https://registry-1.docker.io".tls] insecure_skip_verify = false [host."https://registry-1.docker.io".mirrors] endpoint = ["https://hub-mirror.c.163.com"] 这样配置好了之后发现,直接 ctr i pull nginx 这样是不行的,得敲完整的名称例如 ctr image pull docker.io/library/nginx:latest 我就感觉很不适应,明明 docker 得时候直接写镜像名称得时候默认去官网拉最新得那个 这让人很不舒服 然后问 ai ,ai 说配置成这样(加个[host."docker.io"]) server = "https://registry-1.docker.io"

[host."https://registry-1.docker.io"] capabilities = ["pull", "resolve"] [host."https://registry-1.docker.io".header] # 如果需要认证信息,可以在这里添加 # Authorization = ["Basic <base64_encoded_auth>"] [host."https://registry-1.docker.io".tls] insecure_skip_verify = false [host."https://registry-1.docker.io".mirrors] endpoint = ["https://hub-mirror.c.163.com"]

[host."docker.io"] capabilities = ["pull", "resolve"] [host."docker.io".header] # 如果需要认证信息,可以在这里添加 # Authorization = ["Basic <base64_encoded_auth>"] [host."docker.io".tls] insecure_skip_verify = false [host."docker.io".mirrors] endpoint = ["https://hub-mirror.c.163.com"] ` 就能自动把短名称补全成完整得镜像名称,这样就能直接更具名称去官网拉最新得,但是我改了之后还不行, 然后紧接着我发现个事,就是我啥也不配置也是可以更具完整镜像名称去拉去得

所以我现在怀疑 是不是我这里所有得配置其实都没生效啊?!

所以有懂得老哥么?

840 次点击
所在节点    Kubernetes
2 条回复
xhatt510
52 天前
我是建议你先把格式整理清楚了再发帖问。这怎么看你说,大家的时间都是宝贵的。
miaosl
52 天前
@xhatt510 奇怪了``不是代码块吗再 md 中为啥我发上去之后就这样了

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/1061019

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX