如何在k8s中启动openldap?

如何在k8s中启动openldap?
*** CONTAINER_LOG_LEVEL = 3 (info)
*** Search service in CONTAINER_SERVICE_DIR = /container/service :
*** link /container/service/:ssl-tools/startup.sh to /container/run/startup/:ssl-tools
*** link /container/service/slapd/startup.sh to /container/run/startup/slapd
*** link /container/service/slapd/process.sh to /container/run/process/slapd/run
*** Set environment for startup files
*** Environment files will be proccessed in this order :  Caution: previously defined variables will not be overriden. /container/environment/99-default/default.startup.yaml /container/environment/99-default/default.yaml
To see how this files are processed and environment variables values, run this container with '--loglevel debug'
*** Running /container/run/startup/:ssl-tools...
*** Running /container/run/startup/slapd... Database and config directory are empty... Init new ldap server... invoke-rc.d: could not determine current runlevel invoke-rc.d: policy-rc.d denied execution of stop.   Backing up /etc/ldap/slapd.d in /var/backups/slapd-2.4.44+dfsg-5+deb9u2... done.   Creating initial configuration... done.   Creating LDAP directory... done. invoke-rc.d: could not determine current runlevel invoke-rc.d: policy-rc.d denied execution of start. Start OpenLDAP... Waiting for OpenLDAP to start... Add bootstrap schemas... config file testing succeeded Add image bootstrap ldif... Add custom bootstrap ldif... Disable replication config... Stop OpenLDAP... Remove config files... First start is done...
*** Set environment for container process
*** Remove file /container/environment/99-default/default.startup.yaml
*** Environment files will be proccessed in this order :  Caution: previously defined variables will not be overriden. /container/environment/99-default/default.yaml
To see how this files are processed and environment variables values, run this container with '--loglevel debug'
*** Running /container/run/process/slapd/run...
*** Running --loglevel debug...
*** --loglevel debug exited with status 127.
*** Shutting down /container/run/process/slapd/run (PID 414)...
*** Killing all processes...

当我尝试在 k8s 中启动 osixia/openldap:1.4.0 容器时,我收到上述错误消息。清单文件:

...
    containers:
        - name: ldap
          image: osixia/openldap:1.4.0
          #args: ["--copy-service","--loglevel warning"]
          args: ["--loglevel debug"]
          ports:
          - containerPort: 389
          env:
            - name: LDAP_ADMIN_PASSWORD
              value: "admin"
            - name: LDAP_TLS
              value: "false"
            - name: LDAP_ORGANISATION
              value: "My Company"
            - name: LDAP_DOMAIN
              name: "mycompany.io"

当我添加数据库和配置卷时,我收到不同的错误消息:

To see how this files are processed and environment variables values,
run this container with '--loglevel debug'
*** Running /container/run/process/slapd/run...
5f841fca @(#) $OpenLDAP: slapd 2.4.50+dfsg-1~bpo10+1 (May  4 2020 05:25:06) $
    Debian OpenLDAP Maintainers <[email protected]>
5f841fca daemon: listen URL "ldap://ldap:tcp://10.100.225.153:389" parse error=5
5f841fca slapd stopped.
5f841fca connections_destroy: nothing to destroy.
*** /container/run/process/slapd/run exited with status 1
*** Killing all processes...

知道哪里出了问题吗?非常感谢。

答案1

我认为你遇到了这个问题:https://github.com/osixia/docker-openldap/issues/457

引自那里:

发生这种情况的原因是您将服务命名为 LDAP,而 kubernetes 会自动创建 LDAP_PORT 和许多其他环境变量。

并且 LDAP_PORT 与此 docker 镜像约定相冲突。

解决方案:不要给您的容器命名ldap,选择一个不同的名字。

答案2

答案就在这行:

*** --loglevel debug exited with status 127.

退出状态127基本上意味着command not found

您需要更正文件中的一行yaml。而不是:

args: ["--loglevel debug"]

它应该是:

args: ["--loglevel", "debug"]

并且它会完美地工作。

相关内容