【发布时间】:2020-02-25 08:31:42
【问题描述】:
我有installed Gitlab CE using Helm,但我们的 AD 用户无法登录平台。登录 UI 中显示以下错误:Could not authenticate you from Ldapmain because "Invalid credentials for userX"Invalid credentials for user(但凭据没问题!)
安装:
helm upgrade --install gitlab gitlab/gitlab --namespace my-ns --tiller-namespace tiller-ns --timeout 600 --set global.edition=ce --set global.hosts.domain=example.com --set global.hosts.externalIP=<ExternalIPAddressAllocatedToTheNGINXIngressControllerLBService> --set nginx-ingress.enabled=false --set global.ingress.class=mynginx-ic --set certmanager.install=false --set global.ingress.configureCertmanager=false --set gitlab-runner.install=false --set prometheus.install=false --set registry.enabled=false --set gitlab.gitaly.persistence.enabled=false --set postgresql.persistence.enabled=false --set redis.persistence.enabled=false --set minio.persistence.enabled=false --set global.appConfig.ldap.servers.main.label='LDAP' --set global.appConfig.ldap.servers.main.host=<IPAddressOfMyDomainController> --set global.appConfig.ldap.servers.main.port='389' --set global.appConfig.ldap.servers.main.uid='sAMAccountName' --set global.appConfig.ldap.servers.main.bind_dn='CN=testuser,OU=sampleOU3,OU=sampleOU2,OU=sampleOU1,DC=example,DC=com' --set global.appConfig.ldap.servers.main.password.secret='gitlab-ldap-secret' --set global.appConfig.ldap.servers.main.password.key='password'
注意事项:
-我之前已经单独安装了我自己的 NGINX Ingress Controller:
helm install stable/nginx-ingress --name nginx-ingress --namespace my-ns --tiller-namespace tiller-ns --set controller.ingressClass=mynginx-ic
-我之前创建了一个密码,用户的密码配置为 bind_dn ('CN=testuser,OU=sampleOU3,OU=sampleOU2,OU=sampleOU1,DC=example,DC=com')。密码使用base64编码,如the documentation所示
文件:gitlab-ldap-secret.yaml
apiVersion: v1
kind: Secret
metadata:
name: gitlab-ldap-secret
data:
password: encodedpass-blablabla
-在图表安装期间,我没有在命令行中提供所有这些参数,而是尝试在 this Gitlab Helm chart 提供的各种 values.yaml 中配置所有内容,但以这种方式记录似乎更容易,用于复制目的.
-我试过添加这些参数,没有运气:
--set global.appConfig.ldap.servers.main.encryption='plain'
--set global.appConfig.ldap.servers.main.base='OU=sampleOU1,DC=example,DC=com'
-为了更简单,我们不考虑任何组件的持久性。这就是为什么,这些都设置为 false:
--set gitlab.gitaly.persistence.enabled=false
--set postgresql.persistence.enabled=false
--set redis.persistence.enabled=false
--set minio.persistence.enabled=false
*我确实需要持久性,但这次我们只关注 LDAP 身份验证,这是我目前的主要问题。
-我已经与我的系统管理员核实过,我们在 Active Directory 中使用纯 389。无加密
我的环境
kubectl.exe version
Client Version: version.Info{Major:"1", Minor:"15", GitVersion:"v1.15.1", GitCommit:"4485c6f18cee9a5d3c3b4e523bd27972b1b53892", GitTreeState:"clean", BuildDate:"2019-07-18T09:18:22Z", GoVersion:"go1.12.5", Compiler:"gc", Platform:"windows/amd64"}
Server Version: version.Info{Major:"1", Minor:"15", GitVersion:"v1.15.1", GitCommit:"4485c6f18cee9a5d3c3b4e523bd27972b1b53892", GitTreeState:"clean", BuildDate:"2019-07-18T09:09:21Z", GoVersion:"go1.12.5", Compiler:"gc", Platform:"linux/amd64"}
helm version
Client: &version.Version{SemVer:"v2.14.3", GitCommit:"0e7f3b6637f7af8fcfddb3d2941fcc7cbebb0085", GitTreeState:"clean"}
Server: &version.Version{SemVer:"v2.14.3", GitCommit:"0e7f3b6637f7af8fcfddb3d2941fcc7cbebb0085", GitTreeState:"clean"}
helm ls --tiller-namespace tiller-ns
NAME REVISION UPDATED STATUS CHART APP VERSION NAMESPACE
gitlab 1 Tue Oct 29 18:16:06 2019 DEPLOYED gitlab-2.3.7 12.3.5 my-ns
kubectl.exe get nodes
NAME STATUS ROLES AGE VERSION
kubernetes01.example.com Ready master 102d v1.15.1
kubernetes02.example.com Ready <none> 7h16m v1.15.1
kubernetes03.example.com Ready <none> 102d v1.15.1
kubernetes04.example.com Ready <none> 11d v1.15.1
安装此图表后,一切似乎都正常:
kubectl.exe get pods
NAME READY STATUS RESTARTS AGE
gitlab-gitaly-0 1/1 Running 0 65m
gitlab-gitlab-exporter-5b649bfbb-5pn7q 1/1 Running 0 65m
gitlab-gitlab-shell-7d9497fcd7-h5478 1/1 Running 0 65m
gitlab-gitlab-shell-7d9497fcd7-jvt9p 1/1 Running 0 64m
gitlab-migrations.1-gf8jr 0/1 Completed 0 65m
gitlab-minio-cb5945f79-kztmj 1/1 Running 0 65m
gitlab-minio-create-buckets.1-d2bh5 0/1 Completed 0 65m
gitlab-postgresql-685b68b4d7-ns2rw 2/2 Running 0 65m
gitlab-redis-5cb5c8b4c6-jtfnr 2/2 Running 0 65m
gitlab-sidekiq-all-in-1-5b997fdffd-n5cj2 1/1 Running 0 65m
gitlab-task-runner-5777748f59-gkf9v 1/1 Running 0 65m
gitlab-unicorn-764f6548d5-fmggl 2/2 Running 0 65m
gitlab-unicorn-764f6548d5-pqcm9 2/2 Running 0 64m
现在,如果我尝试使用 LDAP 用户登录,则会收到前面提到的错误。如果我进入独角兽吊舱,我可以在/var/log/gitlab/production.log 中看到以下消息:
Production.log
我错过了什么?我还需要配置什么吗?我已经为提到的 LDAP 身份验证配置了所有参数here,但我仍然无法尝试进行身份验证。
抱歉,我是 Gitlab 及其所有内部组件的新手。我似乎找不到在哪里编辑此文件,例如:/etc/gitlab/gitlab.rb(我应该在哪个 pod 中输入?我逐个输入,但没有找到此配置文件)。另外,我注意到一些文档说可以执行一些诊断工具,例如gitlab-rakegitlab:ldap:check,或诸如gitlab-ctl reconfigure 之类的实用程序,但是再次......在哪里运行这些?在独角兽吊舱上? gitlab 外壳?我注意到各种 Gitlab 文档页面都引用了其中一些工具来解决事件,但我不认为该图表遵循相同的架构。
例如,我查看了this post,因为它似乎是同样的问题,但我找不到/etc/gitlab/gitlab.rb
任何帮助将不胜感激。自从我处理这个问题以来已经有几个星期了。
【问题讨论】:
标签: kubernetes ldap gitlab kubernetes-helm gitlab-ce