docker-openldap icon indicating copy to clipboard operation
docker-openldap copied to clipboard

1.2.4 kubernetes container does not start

Open ballexaa opened this issue 6 years ago • 9 comments
trafficstars

the same configuration works with docker, but kubernetes container has the error:

$ kubectl logs openldap-0 *** 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.yaml /container/environment/99-default/default.startup.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... Error: the config directory (/etc/ldap/slapd.d) is empty but not the database directory (/var/lib/ldap) *** /container/run/startup/slapd failed with status 1

*** Killing all processes...

i didn't manage to set the loglevel to debug.

Does anyone have an idea for this?

ballexaa avatar Jun 04 '19 09:06 ballexaa

This error is caused by startup.sh and is due to your config directory being empty whilst your database one is populated. You need to ensure that either both of them are empty on container start (essentially do nothing in Kube) or mount a persistent volume for both directories.

My setup uses just one PVC instead and have soft-linked the two directories into it by hooking into the postStart lifecycle event, here's my config:

containers:
    image: osixia/openldap:1.2.4
    lifecycle:
      postStart:
        exec:
          command:
          - /bin/bash
          - -c
          - rm -rf /etc/ldap/slapd.d /var/lib/ldap && ln /pvc/etc/ldap/slapd.d /etc/ldap/slapd.d && ln /pvc/var/lib/ldap /var/lib/ldap
    volumeMounts:
    - mountPath: /pvc
      name: openldap-varlib-persistence

zuedev avatar Jul 08 '19 12:07 zuedev

I'm facing the same problem. I use two volumes mounted to /var/lib/ldap and /etc/ldap/slap.d. The osixia/phpldapadmin container crashes in the same way.

meredrica avatar Dec 04 '19 08:12 meredrica

~~Not trying to be critical, but this is outright irrational to block process based on what is and isn't available in the filesystem. My LDAP docker generated the database only and didn't bother to generate it's own config files. And I firmly believe the existence of those predicates isn't critical to the operation of LDAP server~~

Ok, taking it back. Sometimes manual typing can be a pain. I would propose a simple check for typo'd name "... /slap(d?).d/" to at least notify the developer that he has messed up mount location.

bppdddqqqq avatar May 04 '20 21:05 bppdddqqqq

@bppdddqqqq not sure I fully understand what you really want to say in your previous comment but isn't it the case when you see

Error: the config directory (/etc/ldap/slapd.d) is empty but not the database directory (/var/lib/ldap)

when looking at the error message in the original issue ?

obourdon avatar May 06 '20 15:05 obourdon

I'm facing the same problem. I use two volumes mounted to /var/lib/ldap and /etc/ldap/slap.d. The osixia/phpldapadmin container crashes in the same way.

/etc/ldap/slap.d isn't a correct directory. You should fix it to /etc/ldap/slapd.d/ and rebuild the container without old database. Most of the time copy/pasting over new database should work :)

@bppdddqqqq not sure I fully understand what you really want to say in your previous comment but isn't it the case when you see when looking at the error message in the original issue ?

The issue being is that for people with dysgraphy like me, it's very difficult to discern slapd.d between typo'd slap.d, and the typo could be the reason why this issue even exists. I think marking that letter in bold should greatly help diagnosing that something isn't right with what they've typed out by hand rather than what's wrong in the configuration guide.

I believe if the @ballexaa published the configuration settings, he will have slap.d set instead of slapd.d :)

bppdddqqqq avatar May 06 '20 19:05 bppdddqqqq

MAN! I would NEVER have spotted that. Thank you a lot!

meredrica avatar May 13 '20 07:05 meredrica

Has this problem been solved?

cuijianzhe avatar Dec 26 '20 02:12 cuijianzhe

Any update?

singleseeker avatar Aug 03 '21 14:08 singleseeker

Has this problem been solved?

ilanni2460 avatar May 09 '23 06:05 ilanni2460