最近半个多月我被vim编译器坑死了,自己挖了个大坑,耗时20多天才爬出来。不管怎么样,爬出来了,总该庆贺一下。
我前不久安装了harbor要建立私有仓库。要创建自己的私有仓库首先要配置harbor 同docker通信,要让docker 可以通过login登录harbor,并且可以通过push上传镜像到harbor里面。
我的harbor是通过helm安装,ingress控制器使用的traefik,并将traefik的服务通过noteport暴露出来,使之所有https服务都有了统一的访问入口,端口号为32042。
参考官网Harbor docs | Configure HTTPS Access to Harbor
我做了使用自己创建的密钥访问https,密钥制作方式和官网一致,我重点说一下helm安装的harbor配置。
首先,创建自定义的secret,参考Harbor docs | Customize the Harbor Token Service 这里使用的域名和Common Name都使用 *.harbor.shell.com
将用于的docker pull 和 push images 的token密钥也做进去。
kubectl create secret generic harbor-ingress-custom \
--from-file=ca.crt \
--from-file=tls.crt \
--from-file=tls.key \
--from-file=private_key.pem \
--from-file=root.crt \
--type=kubernetes.io/tls -n harbor
修改values.yaml文件
1、certSource: secret //这里修改为从自定义secret取密钥
2、 secret:
# The name of secret which contains keys named:
# "tls.crt" - the certificate
# "tls.key" - the private key
secretName: "harbor-ingress-custom" //修改为刚才创建的secret名
# The name of secret which contains keys named:
# "tls.crt" - the certificate
# "tls.key" - the private key
# Only needed when the "expose.type" is "ingress".
notarySecretName: "harbor-ingress-custom" //这里同上
ingress:
hosts:
3、 ingress:
annotations:
//这里加一条
kubernetes.io/ingress.class: "traefik"
4、 externalURL: https://core.harbor.shell.com:32042
5、然后就是设置存储storageClass ,安装的时候说过,这里不做赘述
6、然后在这里找到
# The initial password

作者分享了在部署Harbor私有仓库时遭遇的挑战,包括TLS配置错误、docker登录问题和证书导入困扰。最终通过排查发现yaml文件格式问题,提醒读者注意yaml书写规范。
最低0.47元/天 解锁文章
1855

被折叠的 条评论
为什么被折叠?



