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]# lscharts 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
部署服务,步骤与之前大同小异
[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 hb-ldap-harbor-adminserver hb-ldap-harbor-chartmuseum hb-ldap-harbor-clair hb-ldap-harbor-jobservice hb-ldap-harbor-notary-server hb-ldap-harbor-notary-signer hb-ldap-harbor-registry hb-ldap-harbor-ui
==> v1beta2/StatefulSet
hb-ldap-harbor-database NOTES:
Pleasewait for several minutes forHarbor 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 | grepldap
hb-ldap-harbor-adminserver-69cb46cf9b-ptlvb 1/1 Running 12h
hb-ldap-harbor-chartmuseum-88449c77f-dmxsk 1/1 Running 02h
hb-ldap-harbor-clair-bbc78b6df-n4c4l 1/1 Running 42h
hb-ldap-harbor-database-0 1/1 Running 02h
hb-ldap-harbor-jobservice-86bb5b45c8-8ssc6 1/1 Running 32h
hb-ldap-harbor-notary-server-b659bb7f4-hr6lm 1/1 Running 12h
hb-ldap-harbor-notary-signer-7f8b5dfcf-7pvtk 1/1 Running 12h
hb-ldap-harbor-registry-77d5884f77-7lxcr 1/1 Running 02h
hb-ldap-harbor-ui-7c7cc6c474-554xb 1/1 Running 22h
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镜像及证书配置,详情请点击
赞助作者: