2

I am trying to create an OpenLdap instance using image osixia/openldap:1.5.0 as a k8s service. Image works really well and the Ldap instance is also worked fine. However, when I'm trying to create users using user.ldif file, getting error. I created a configmap nameing users and mounted it to the k8s cluster.

openldap.yaml

apiVersion: apps/v1
kind: Deployment
metadata:
  name: open-ldap-pod
  labels:
    app: open-ldap-pod
spec:
  selector:
    matchLabels:
      app: open-ldap-pod
  replicas: 1
  template:
    metadata:
      labels:
        app: open-ldap-pod
    spec:
      containers:
      - name: open-ldap-pod
        image: osixia/openldap:1.5.0
        args: [ "-c", "/container/tool/run --copy-service" ]
        ports:
        - containerPort: 389
          name: openldap
        volumeMounts:
        - name: users
          mountPath: /container/service/slapd/assets/config/bootstrap/ldif/custom/users.ldif
          subPath: users.ldif
      volumes:
      - name: users
        configMap:
         name: users
         items:
         - key: users.ldif
           path: users.ldif

users.ldif

dn: ou=People,dc=example,dc=org
ou: People
objectClass: organizationalUnit

dn: cn=john,ou=People,dc=example,dc=org
myAttribute1: myAttribute
myAttribute2: myAttribute
sn: john
mail: john@example.org
cn: john
objectClass: personnel

dn: cn=mike,ou=People,dc=example,dc=org
myAttribute1: myAttribute
myAttribute2: myAttribute
sn: mike
mail: mike@example.org
cn: mike
objectClass: personnel

Error Stack:

*** 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/tool/run --copy-service'...
*** CONTAINER_LOG_LEVEL = 3 (info)
*** Copy /container/service to /container/run/service
*** Search service in CONTAINER_SERVICE_DIR = /container/run/service :
*** link /container/run/service/:ssl-tools/startup.sh to /container/run/startup/:ssl-tools
*** failed to link /container/run/service/:ssl-tools/startup.sh to /container/run/startup/:ssl-tools: [Errno 17] File exists: '/container/run/service/:ssl-tools/startup.sh' -> '/container/run/startup/:ssl-tools'
*** link /container/run/service/slapd/startup.sh to /container/run/startup/slapd
*** failed to link /container/run/service/slapd/startup.sh to /container/run/startup/slapd: [Errno 17] File exists: '/container/run/service/slapd/startup.sh' -> '/container/run/startup/slapd'
*** link /container/run/service/slapd/process.sh to /container/run/process/slapd/run
*** directory /container/run/process/slapd already exists
*** failed to link /container/run/service/slapd/process.sh to /container/run/process/slapd/run : [Errno 17] File exists: '/container/run/service/slapd/process.sh' -> '/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...
openldap user and group adjustments
get current openldap uid/gid info inside container
-------------------------------------
openldap GID/UID
-------------------------------------
User uid: 911
User gid: 911
uid/gid changed: false
-------------------------------------
updating file uid/gid ownership
Database and config directory are empty...
Init new ldap server...
  Backing up /etc/ldap/slapd.d in /var/backups/slapd-2.4.50+dfsg-1~bpo10+1... 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 restart.
Start OpenLDAP...
Waiting for OpenLDAP to start...
Add bootstrap schemas...
config file testing succeeded
Add image bootstrap ldif...
Add custom bootstrap ldif...
*** /container/run/startup/slapd failed with status 68

*** Killing all processes...
*** /container/tool/run failed with status 1

*** Killing all processes...

Is there anything that I'm missing here?

Aftab
  • 2,863
  • 32
  • 41

0 Answers0