kubernetes實戰(十三):k8s使用helm持久化部署harbor集成openLDAP登錄


1、基本概念

  上節在k8s中部署了harbor和ldap,本節將部署harbor使用openLDAP驗證,部署方式與之前相同,只是改了adminserver-cm.yaml的AUTH_MODE: "ldap_auth"。另外harbor配置ldap登錄非必須,按需。

 

2、部署

  下載項目

git clone https://github.com/dotbalo/helm.git
[root@k8s-master01 ci]# cd harbor-helm-ldap/
[root@k8s-master01 harbor-helm-ldap]# ls
charts      CONTRIBUTING.md  README.md          requirements.yaml  values.yaml
Chart.yaml  LICENSE          requirements.lock  templates
[root@k8s-master01 harbor-helm-ldap]# pwd
/root/ci/harbor-helm-ldap

  具體配置可參考:k8s使用Helm安裝harbor

  部署服務,步驟與之前大同小異

[root@k8s-master01 harbor-helm-ldap]# helm install --name hb-ldap .  --set externalDomain=harbor.xxx.net --wait --timeout 1500 --debug --namespace harbor
.....
==> v1beta1/Deployment
hb-ldap-redis                 <invalid>
hb-ldap-harbor-adminserver    <invalid>
hb-ldap-harbor-chartmuseum    <invalid>
hb-ldap-harbor-clair          <invalid>
hb-ldap-harbor-jobservice     <invalid>
hb-ldap-harbor-notary-server  <invalid>
hb-ldap-harbor-notary-signer  <invalid>
hb-ldap-harbor-registry       <invalid>
hb-ldap-harbor-ui             <invalid>

==> v1beta2/StatefulSet
hb-ldap-harbor-database  <invalid>


NOTES:
Please wait for several minutes for Harbor deployment to complete.
Then you should be able to visit the UI portal at https://harbor.xxx.net. 
For more details, please visit https://github.com/goharbor/harbor.

  查看pods

 

[root@k8s-master01 harbor-helm-ldap]# kubectl get po -n harbor | grep ldap
hb-ldap-harbor-adminserver-69cb46cf9b-ptlvb       1/1       Running   1          2h
hb-ldap-harbor-chartmuseum-88449c77f-dmxsk        1/1       Running   0          2h
hb-ldap-harbor-clair-bbc78b6df-n4c4l              1/1       Running   4          2h
hb-ldap-harbor-database-0                         1/1       Running   0          2h
hb-ldap-harbor-jobservice-86bb5b45c8-8ssc6        1/1       Running   3          2h
hb-ldap-harbor-notary-server-b659bb7f4-hr6lm      1/1       Running   1          2h
hb-ldap-harbor-notary-signer-7f8b5dfcf-7pvtk      1/1       Running   1          2h
hb-ldap-harbor-registry-77d5884f77-7lxcr          1/1       Running   0          2h
hb-ldap-harbor-ui-7c7cc6c474-554xb                1/1       Running   2          2h
hb-ldap-redis-d98d67f8b-wp6pm                     1/1       Running   0          2h

  將harbor.xxx.net添加解析至集群

  訪問測試

 

 3、配置使用ldap登錄

  注意:因為openLDAP部署在了public-service的namespace中,而harbor部署在了harbor的namespace中,此時兩個ns的service是不同的,有兩個解決方案

  使用nodeport或者使用service全地址,格式為ServiceName.NAMESPACE.svc。

  配置如下,注意harbor也使用mail進行認證,非cn:

  連接測試

 

4、創建用戶和組  

  創建組

  用戶無需自己創建,可以直接登錄。注意我公司使用的是email地址進行登錄。

  登錄測試

 

5、創建項目

  push鏡像及證書配置,詳情請點擊

 

贊助作者:

  


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM