溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點(diǎn)擊 登錄注冊 即表示同意《億速云用戶服務(wù)條款》

harbor在kubernetes helm是怎樣安裝使用的

發(fā)布時(shí)間:2021-10-12 11:33:02 來源:億速云 閱讀:187 作者:柒染 欄目:云計(jì)算

今天就跟大家聊聊有關(guān)harbor在kubernetes helm是怎樣安裝使用的,可能很多人都不太了解,為了讓大家更加了解,小編給大家總結(jié)了以下內(nèi)容,希望大家根據(jù)這篇文章可以有所收獲。

  • 環(huán)境:kubernetes 1.18+,helm3

  • 添加Harbor的Helm repository

helm repo add harbor https://helm.goharbor.io
helm repo update
  • 創(chuàng)建namespace

kubectl create namespace harbor-system
  • 創(chuàng)建harbor-overrides.yaml。導(dǎo)出類型修改為clusterIP,后面會(huì)用traefik導(dǎo)出外網(wǎng)并自動(dòng)管理證書,pvc根據(jù)實(shí)際情況修改。存儲(chǔ)方案參考我的 https://my.oschina.net/u/160697/blog/4422610

externalURL: https://registry.your_domain.com:31000
expose:
  type: clusterIP
  tls:
    auto:
      commonName: harbor
persistence:
  persistentVolumeClaim:
    registry:
      storageClass: rook-cephfs
      accessMode: ReadWriteMany
      size: 1024Gi
    chartmuseum:
      storageClass: rook-cephfs
      accessMode: ReadWriteMany
    jobservice:
      storageClass: rook-cephfs
      accessMode: ReadWriteMany
    database:
      storageClass: rook-cephfs
      accessMode: ReadWriteMany
    redis:
      storageClass: rook-cephfs
      accessMode: ReadWriteMany
    trivy:
      storageClass: rook-cephfs
      accessMode: ReadWriteMany
  • 安裝,要拉鏡像,啟動(dòng)10多個(gè)容器需要多等,也可以刪除pod嘗試

helm install -f harbor-overrides.yaml --namespace harbor-system harbor harbor/harbor
  • 升級(jí)

helm upgrade -f harbor-overrides.yaml --namespace harbor-system harbor harbor/harbor
  • 卸載

helm uninstall harbor -n harbor-system
# 下面這個(gè)刪除命名空間,會(huì)把存儲(chǔ)一起刪除
# kubectl delete ns harbor-system
  •  導(dǎo)出traefik。參考 https://my.oschina.net/u/160697/blog/4437939

kind: Ingress
apiVersion: networking.k8s.io/v1beta1
metadata:
  name: harbor-ingress
  namespace: harbor-system
  annotations:
    traefik.ingress.kubernetes.io/router.tls: "true"
    traefik.ingress.kubernetes.io/router.entrypoints: websecure
    traefik.ingress.kubernetes.io/router.tls.certresolver: aliyun
    traefik.ingress.kubernetes.io/router.tls.domains.0.main: registry.your_domain.com

spec:
  rules:
    - host: registry.your_domain.com
      http:
        paths:
          - path: /
            pathType: ImplementationSpecific
            backend:
              serviceName: harbor-harbor-portal
              servicePort: 80
          - path: /api/
            pathType: ImplementationSpecific
            backend:
              serviceName: harbor-harbor-core
              servicePort: 80
          - path: /service/
            pathType: ImplementationSpecific
            backend:
              serviceName: harbor-harbor-core
              servicePort: 80
          - path: /v2/
            pathType: ImplementationSpecific
            backend:
              serviceName: harbor-harbor-core
              servicePort: 80
          - path: /chartrepo/
            pathType: ImplementationSpecific
            backend:
              serviceName: harbor-harbor-core
              servicePort: 80
          - path: /c/
            pathType: ImplementationSpecific
            backend:
              serviceName: harbor-harbor-core
              servicePort: 80
  • 登錄https://registry.your_domain.com:31000。默認(rèn)帳號(hào)密碼是admin/Harbor12345。單獨(dú)創(chuàng)建一個(gè)使用的帳號(hào)密碼,具體就不寫了。

  • docker中使用。輸入docker login后輸入帳號(hào)密碼。然后就可以docker tag。在docker push就ok

#輸入帳號(hào)密碼
sudo docker login

看完上述內(nèi)容,你們對harbor在kubernetes helm是怎樣安裝使用的有進(jìn)一步的了解嗎?如果還想了解更多知識(shí)或者相關(guān)內(nèi)容,請關(guān)注億速云行業(yè)資訊頻道,感謝大家的支持。

向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI