Habapp Docker Image in Kubernetes Config File

Hi,
I’ve built a Kubernetes cluster (k8s) and am in the process of migrating my OpenHab 4 (initial testing looking promising, but I need to do some work on the Docker Image).
I’m looking at HabApp now and I’ve managed to get a deployment to install and a test rule added via a ConfigMap.
However, trying to also apply the config.yml as a ConfigMap causes the deployment to fail.
The file seems to be in /habapp/config/config.yml.
Looking at the Docker method of installing:

docker run --rm -it --name habapp \
    -v ${PWD}/habapp_config:/habapp/config \
    -e TZ=Europe/Berlin \
    -e USER_ID=9001 \
    -e GROUP_ID=9001 \
    spacemanspiff2007/habapp:latest

This line “-v ${PWD}/habapp_config:/habapp/config” seems to be how Docker maps and binds “volumes” but I’m not sure how I can do this. My current method of mounting causes an error during deployment if readOnly: true and the file gets overwritten by the default config if I set it to false.

---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: pv-habapp
  namespace: openhab
spec:
  storageClassName: rook-ceph-block
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 1Gi
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: habapp
  namespace: openhab
  labels:
    app: habapp
spec:
  replicas: 1
  selector:
    matchLabels:
      app: habapp
  template:
    metadata:
      labels:
        app: habapp
    spec:
      hostNetwork: true
      containers:
      - name: habapp
        image: spacemanspiff2007/habapp:latest
        volumeMounts:
        - name: habapp-config   # issue with this overwriting the config - how do we replace default config????????
          mountPath: /habapp/config
          readOnly: false
      volumes:
      - name: habapp
        persistentVolumeClaim:
          claimName: pv-habapp
      - name: habapp-config
        configMap:
          name: habapp-config

Has anyone else managed to get this to work on Kubernetes?

Thanks,
Richie

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.