Unifi-controller mongodb fails to setup socket

Hi,

I’m trying to get the unifi-controller running on k8s. It works when I don’t use persistent volumes, when I use a hostPath volume mongodb fails to bind a socket. PGID/PUID 1000 is the id of the docker user in minikube, it has root and write access to the host/unificonfig folder.

Anyone have any idea on whats going on?

SETUP:
Ubuntu 19.10
minikube

k8s-deployment.yaml

apiVersion: apps/v1
kind: Deployment
metadata:
  name: unifi-controller
  labels:
    app: unifi-controller
spec:
  replicas: 1
  selector:
    matchLabels:
      app: unifi
  template:
    metadata:
      labels:
        app: unifi    
    spec:
      containers:
      - name: unifi-controller
        image: linuxserver/unifi-controller
        volumeMounts:
        - mountPath: /config
          name: unifi-storage
        env:
          - name: PGID
            value: "1000"
          - name: PUID
            value: "1000"
      volumes:
      - name: unifi-storage
        hostPath:
          type: Directory
          path: /host/unificonfig

mongod.log

2019-11-14T20:00:32.703+0000 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.0.2g 1 Mar 2016
2019-11-14T20:00:32.704+0000 I CONTROL [initandlisten] allocator: tcmalloc
2019-11-14T20:00:32.704+0000 I CONTROL [initandlisten] modules: none
2019-11-14T20:00:32.705+0000 I CONTROL [initandlisten] build environment:
2019-11-14T20:00:32.705+0000 I CONTROL [initandlisten] distmod: ubuntu1604
2019-11-14T20:00:32.705+0000 I CONTROL [initandlisten] distarch: x86_64
2019-11-14T20:00:32.706+0000 I CONTROL [initandlisten] target_arch: x86_64
2019-11-14T20:00:32.706+0000 I CONTROL [initandlisten] options: { net: { bindIp: “127.0.0.1”, port: 27117, unixDomainSocket: { pathPrefix: “/usr/lb/unifi/run” } }, storage: { dbPath: “/usr/lib/unifi/data/db” }, systemLog: { destination: “file”, logAppend: true, path: “/usr/lib/unifi/logs/mongod.log” } }
2019-11-14T20:00:32.723+0000 E NETWORK [initandlisten] listen(): bind() failed Operation not permitted for socket: /usr/lib/unifi/run/mongodb-27117.sock
2019-11-14T20:00:32.723+0000 E NETWORK [initandlisten] Failed to set up sockets during startup.
2019-11-14T20:00:32.724+0000 E STORAGE [initandlisten] Failed to set up listener: InternalError: Failed to set up sockets
2019-11-14T20:00:32.724+0000 I NETWORK [initandlisten] shutdown: going to close listening sockets…
2019-11-14T20:00:32.724+0000 I NETWORK [initandlisten] shutdown: going to flush diaglog…
2019-11-14T20:00:32.725+0000 I CONTROL [initandlisten] now exiting
2019-11-14T20:00:32.725+0000 I CONTROL [initandlisten] shutting down with code:48

Hi @molotch
I am having the exact same issue trying to get unifi-controller running on k3s. Did you find a solution ?

i have the exact same problem, as far as i have understand, the problem is mongodb that dosent work with mounted volumes as expected, it seems to b ea documented bug. Hope someone can tell us how to fix this its driving me crazy, im using Azure Container Services and mount my storage like this:

apiVersion: ‘2019-12-01’

location: westus

name: vcongdl

properties:

containers:

  • name: vcongdl

    properties:

    environmentVariables: []

    image: lscr.io/linuxserver/unifi-controller

    ports:

    • port: 80

    • port: 8080

    • port: 8443

    • port: 6789

    • port: 3478

      protocol: udp

    • port: 10001

      protocol: udp

    • port: 1900

      protocol: udp

    • port: 5514

      protocol: udp

    resources:

    requests:
    
      cpu: 1.0
    
      memoryInGB: 1.0
    

    volumeMounts:

    • mountPath: /config

      name: vconacishare2

osType: Linux

restartPolicy: Always

ipAddress:

type: Public

ports:

- protocol: tcp

  port: '80'

- protocol: tcp

  port: '8080'

- protocol: tcp

  port: '8443'

- protocol: tcp

  port: '6789'    

- protocol: udp

  port: '3478'

- protocol: udp

  port: '10001'

- protocol: udp

  port: '1900'

- protocol: udp

  port: '5514'      

dnsNameLabel: vcongdl

volumes:

  • name: vconacishare2

    azureFile:

    sharename: vconacishare2

    storageAccountName: vconstorage2

    storageAccountKey: /6/cdSJnNoy2gWrMQgpDCxA==

tags: {}

type: Microsoft.ContainerInstance/containerGroups