一、基本概念html
上節在k8s中部署了harbor和ldap,本節將部署harbor使用openLDAP驗證,部署方式與以前相同,只是改了adminserver-cm.yaml的AUTH_MODE: "ldap_auth"。另外harbor配置ldap登陸非必須,按需。node
二、部署git
下載項目github
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安裝harborredis
部署服務,步驟與以前大同小異post
[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添加解析至集羣ui
訪問測試url
三、配置使用ldap登陸spa
注意:由於openLDAP部署在了public-service的namespace中,而harbor部署在了harbor的namespace中,此時兩個ns的service是不一樣的,有兩個解決方案
使用nodeport或者使用service全地址,格式爲ServiceName.NAMESPACE.svc。
配置以下,注意harbor也使用mail進行認證,非cn:
鏈接測試
四、建立用戶和組
建立組
用戶無需本身建立,能夠直接登陸。注意我公司使用的是email地址進行登陸。
登陸測試
五、建立項目
push鏡像及證書配置,詳情請點擊
贊助做者: