harbor_ins

harbor_ins

ubuntu 20.04.6
k8s”v1.24.6″

自建harbor仓库

1. kubectl create namespace harbor || true
2. kubectl -n harbor create secret tls harbor-tls --cert=./tls.pem --key=./tls.key

配置并检查环境

安装

sealos安装会被忽略参数,upgrade再安装一次,文件版本可以helm list -n harbor 或者 ~/.cache/helm/ 查看
sealos run registry.cn-shanghai.aliyuncs.com/labring/harbor:v2.8.2 -e HELM_OPTS="--set externalURL=https://harbor-huizhou01.sunwoda-evb.com"
helm uninstall harbor -n harbor
helm install harbor harbor/harbor -n harbor \
  --version 1.12.2 \
  --set externalURL=https://harbor-huizhou01.igozhang.cn\
  --set expose.ingress.hosts.core=harbor-huizhou01.igozhang.cn\
  --set expose.ingress.ingressClassName=nginx \
  --set expose.ingress.annotations."kubernetes\.io/ingress\.class"=nginx \
  --set expose.tls.enabled=true \
  --set expose.tls.certSource=secret \
  --set expose.tls.secret.secretName=harbor-tls \
  --set notary.enabled=false \
  --set harborAdminPassword=Harbor@2026
完了还是用默认密码登录,set未生效
用户名:admin
密码:Harbor12345


次选:(版本不要太高,否则报错)
helm repo add harbor https://helm.goharbor.io
helm repo update
helm search repo harbor --versions
helm pull harbor/harbor --version 1.12.6
helm install harbor ./harbor-1.12.6.tgz \
  -n harbor \
  --set externalURL=https://harbor-huizhou01.igozhang.cn\
  --set expose.ingress.hosts.core=harbor-huizhou01.igozhang.cn\
  --set expose.tls.enabled=true \
  --set expose.tls.secretName=harbor-tls \
  --set harborAdminPassword=Harbor@2026
这样安装完后,镜像拉不到
helm uninstall harbor -n harbor

将本地images推到私有habor

原有镜像:
# docker images
REPOSITORY                                                                 TAG                               IMAGE ID       CREATED         SIZE
harbor-dianbai.sunwoda-evb.com/mom/6x575i8_prod                            r116                              b0574344e80b   6 days ago      1.31GB

打tag
# 方式1:用原镜像名打标签(推荐,更清晰)
docker tag harbor-dianbai.sunwoda-evb.com/mom/6x575i8_prod:r116 harbor-huizhou01.sunwoda-evb.com/pub/mom:r116
# 方式2:用镜像ID打标签(兜底,避免原镜像名复杂出错)
# docker tag b0574344e80b harbor-huizhou01.sunwoda-evb.com/pub/mom:r116

login才能推送
docker login harbor-huizhou01.sunwoda-evb.com
docker push harbor-huizhou01.sunwoda-evb.com/pub/mom:r116

可以在其他机器拉取验证:
docker pull harbor-huizhou01.sunwoda-evb.com/pub/mom:r116

igozhang 2021