一、harbor官网高可用方案

采用 k8s helm 进行部署

https://goharbor.io/docs/2.3.0/install-config/harbor-ha-helm/

在这里插入图片描述

二、部署步骤

拷贝 harbor 的 helm 工程

git clone https://github.com/goharbor/harbor-helm.git

修改 values.yaml

expose:
  # Set the way how to expose the service. Set the type as "ingress",
  # "clusterIP", "nodePort" or "loadBalancer" and fill the information
  # in the corresponding section
  type: nodePort #设置对外暴露的端口,harbor NodePort 10.233.21.241   <none>   80:30002/TCP,4443:30004/TCP   15m
  tls:
    # Enable the tls or not.
    # Delete the "ssl-redirect" annotations in "expose.ingress.annotations" when TLS is disabled and "expose.type" is "ingress"
    # Note: if the "expose.type" is "ingress" and the tls
    # is disabled, the port must be included in the command when pull/push
    # images. Refer to https://github.com/goharbor/harbor/issues/5291
    # for the detail.
    enabled: false #默认设置为http,而不是https


# Format: protocol://domain[:port]. Usually:
# 1) if "expose.type" is "ingress", the "domain" should be
# the value of "expose.ingress.hosts.core"
# 2) if "expose.type" is "clusterIP", the "domain" should be
# the value of "expose.clusterIP.name"
# 3) if "expose.type" is "nodePort", the "domain" should be
# the IP address of k8s node
#
# If Harbor is deployed behind the proxy, set it as the URL of proxy
externalURL: http://10.51.13.13:30002  #该地址必须填写正确,否者docker login报错

注意:默认为 30002登录

以上配置需要注意,不然会出现问题
externalURL: http://10.51.13.13:30002 #该地址必须填写正确,否者docker login报错

执行部署

helm install my-harbor harbor-helm-master

查看pod和service

kubectl get pods

NAME                                       READY   STATUS    RESTARTS   AGE
my-harbor-chartmuseum-6fcf65d46d-t2rq6     1/1     Running   0          3d2h
my-harbor-core-769756845-2sfbp             1/1     Running   0          3d2h
my-harbor-database-0                       1/1     Running   0          3d2h
my-harbor-jobservice-79b57d9679-vdcn6      1/1     Running   1          3d2h
my-harbor-nginx-65bd69b896-v4lqv           1/1     Running   0          3d2h
my-harbor-notary-server-77b4485d9d-ct77n   1/1     Running   1          3d2h
my-harbor-notary-signer-667fdcf98c-rpbgx   1/1     Running   0          3d2h
my-harbor-portal-75b4d94c46-fhgnz          1/1     Running   0          3d2h
my-harbor-redis-0                          1/1     Running   0          3d2h
my-harbor-registry-76cdcbb567-c8p6q        2/2     Running   0          3d2h
my-harbor-trivy-0                          1/1     Running   0          3d2h

kubectl get svc

NAME                      TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)                       AGE
harbor                    NodePort    10.233.21.241   <none>        80:30002/TCP,4443:30004/TCP   3d2h
my-harbor-chartmuseum     ClusterIP   10.233.52.226   <none>        80/TCP                        3d2h
my-harbor-core            ClusterIP   10.233.63.77    <none>        80/TCP                        3d2h
my-harbor-database        ClusterIP   10.233.42.144   <none>        5432/TCP                      3d2h
my-harbor-jobservice      ClusterIP   10.233.12.208   <none>        80/TCP                        3d2h
my-harbor-notary-server   ClusterIP   10.233.35.27    <none>        4443/TCP                      3d2h
my-harbor-notary-signer   ClusterIP   10.233.34.250   <none>        7899/TCP                      3d2h
my-harbor-portal          ClusterIP   10.233.16.184   <none>        80/TCP                        3d2h
my-harbor-redis           ClusterIP   10.233.45.54    <none>        6379/TCP                      3d2h
my-harbor-registry        ClusterIP   10.233.38.237   <none>        5000/TCP,8080/TCP             3d2h
my-harbor-trivy           ClusterIP   10.233.34.247   <none>        8080/TCP                      3d2h

三、结果

登录 http://10.51.13.13:30002

在这里插入图片描述

Logo

开放原子开发者工作坊旨在鼓励更多人参与开源活动,与志同道合的开发者们相互交流开发经验、分享开发心得、获取前沿技术趋势。工作坊有多种形式的开发者活动,如meetup、训练营等,主打技术交流,干货满满,真诚地邀请各位开发者共同参与!

更多推荐