h-a: Config Zigbee2MQTT w/ env vars
Zigbee2MQTT commits the cardinal sin of storing state in its configuration file. This means the file has to be writable and thus stored in persistent storage rather than in a ConfigMap. As a consequence, making changes to the configuration when the application is not running is rather difficult. Case in point: when I added the internal alias for _mqtt.pyrocufflink.blue_ pointing to the in-cluster service, Zigbee2MQTT became unable to connect to the broker because it was using the node port instead of the internal port. Since it could not connect to the broker, it refused to start, and thus the container would not stay running long enough to fix the configuration to point to the correct port. Fortunately, Zigbee2MQTT also allows configuring settings via environment variables, which can be managed with a ConfigMap. Luckily, the values read from environment variables override those from the configuration file, so pointing to the correct broker port with the environment variable was sufficient to allow the application to start.xactmon-doc
parent
a785fcec73
commit
5b34547730
|
@ -41,6 +41,10 @@ configMapGenerator:
|
||||||
files:
|
files:
|
||||||
- mosquitto.conf
|
- mosquitto.conf
|
||||||
|
|
||||||
|
- name: zigbee2mqtt
|
||||||
|
envs:
|
||||||
|
- zigbee2mqtt.env
|
||||||
|
|
||||||
patches:
|
patches:
|
||||||
- patch: |-
|
- patch: |-
|
||||||
apiVersion: apps/v1
|
apiVersion: apps/v1
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
ZIGBEE2MQTT_CONFIG_MQTT_SERVER=mqtts://mqtt.pyrocufflink.blue:8883
|
|
@ -61,6 +61,10 @@ spec:
|
||||||
containers:
|
containers:
|
||||||
- name: zigbee2mqtt
|
- name: zigbee2mqtt
|
||||||
image: docker.io/koenkk/zigbee2mqtt:1.33.1
|
image: docker.io/koenkk/zigbee2mqtt:1.33.1
|
||||||
|
envFrom:
|
||||||
|
- configMapRef:
|
||||||
|
name: zigbee2mqtt
|
||||||
|
optional: true
|
||||||
ports:
|
ports:
|
||||||
- containerPort: 8080
|
- containerPort: 8080
|
||||||
name: http
|
name: http
|
||||||
|
|
Loading…
Reference in New Issue