k8s

containerd对接harbor

1.步骤

containerd不像docker,在/etc/docker/deamon.json文件配置一下insecure-registries就可以使用了,它的配置文件较复杂。
默认配置文件可以通过命令生成

containerd config default > /etc/containerd/config.toml
注意生成前,看目录中配置文件是否已存在,不然会覆盖掉原有的配置。

修改配置文件:

vim /etc/containerd/config.toml

file

重启containerd

systemctl restart containerd

登录harbor

nerdctl login https://harbor.wghdr.top

2.坑

harbor无法登录

file
这里报错是因为没有加–insecure-registry参数。

nerdctl login  -u xxx--insecure-registry https://harbor.wghdr.top

登录成功。
file

nerdctl push报错:Request Entity Too Large

file
这里报错是因为ingress-nginx的配置文件中client_max_body_size参数过小。
file
修改参数:

client_body_timeout             120s;
client_header_timeout           120s;
client_max_body_size                    500m;

location /configuration 中的client_max_body_size 21m不用改

file
替换配置文件,重启nginx。

k cp nginx.conf ingress-nginx-ingress-controller-557b9f5d7-9qfzc:/etc/nginx/nginx.conf -n ingress
k exec -it ingress-nginx-ingress-controller-557b9f5d7-9qfzc -n ingress -- bash
nginx -t
nginx -s reload

file

nerdctl push报错401

参考这篇博客:https://www.cnblogs.com/chenminklutz/p/13446164.html
注释 proxy_set_header X-Forwarded-Proto $pass_access_scheme;;
file

ctr push 报错:ctr: content digest sha256:xxxxxx not found

解决:
下载完整的镜像

ctr image pull --all-platforms docker.io/library/redis:alpine
ctr images tag docker.io/library/redis:alpine harbor.wghdr.top/harbor/redis:alpine
ctr images push -k harbor.wghdr.top/harbor/redis:alpine

nerdctl/ctr push 报错:cannot reuse body, request must be retried(暂未解决)

file
GitHub上有一个issue,说是containerd的bug。
https://github.com/containerd/containerd/issues/5978
我的containerd版本是1.4.3,nerdctl版本是v0.16.0
file
这是harbor-core的日志
file
如果有大佬知道解决方法,请告知一下,感谢🙏

分类: k8s
0 0 投票数
文章评分
订阅评论
提醒
guest

3 评论
最旧
最新 最多投票
内联反馈
查看所有评论
小飞飞
1 年 前

请问这个问题你解决了吗?我是用nexus时遇到了这个问题,也是用nerdctl推不上去。解决不了只能用docker push啦

jeyrce
1 年 前

我用buildx 往harbor推镜像也遇到了,至今没有解决

相关文章

开始在上面输入您的搜索词,然后按回车进行搜索。按ESC取消。

返回顶部
0
希望看到您的想法,请您发表评论x