home-assistant: Deploy Home Assistant

This commit adds resources for deploying the Home Assistant ecosystem
inside Kubernetes.  Home Assistant itself, as well as Mosquitto, are
just normal Pods, managed by StatefulSets, that can run anywhere.
ZWaveJS2MQTT and Zigbee2MQTT, on the other hand, have to run on a
special node (a Raspberry Pi), where the respective controllers are
attached.

The Home Assistant UI is exposed externally via an Ingress resource.
The MQTT broker is also exposed externally, using the TCP proxy feature
of *ingress-nginx*.  Additionally, the Zigbee2MQTT and ZWaveJS2MQTT
control panels are exposed via Ingress resources, but these are
protected by Authelia.
This commit is contained in:
2023-07-24 17:48:38 -05:00
parent 2153097930
commit a7eac14d39
17 changed files with 1870 additions and 0 deletions

View File

@@ -0,0 +1,105 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
labels:
app.kubernetes.io/component: zigbee2mqtt
app.kubernetes.io/instance: zigbee2mqtt
app.kubernetes.io/name: zigbee2mqtt
app.kubernetes.io/part-of: home-assistant
name: zigbee2mqtt
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
---
apiVersion: v1
kind: Service
metadata:
labels:
app.kubernetes.io/component: zigbee2mqtt
app.kubernetes.io/instance: zigbee2mqtt
app.kubernetes.io/name: zigbee2mqtt
app.kubernetes.io/part-of: home-assistant
name: zigbee2mqtt
spec:
ports:
- port: 8080
name: http
selector:
app.kubernetes.io/component: zigbee2mqtt
app.kubernetes.io/instance: zigbee2mqtt
app.kubernetes.io/name: zigbee2mqtt
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
labels:
app.kubernetes.io/component: zigbee2mqtt
app.kubernetes.io/instance: zigbee2mqtt
app.kubernetes.io/name: zigbee2mqtt
app.kubernetes.io/part-of: home-assistant
name: zigbee2mqtt
spec:
serviceName: zigbee2mqtt
selector:
matchLabels:
app.kubernetes.io/component: zigbee2mqtt
app.kubernetes.io/instance: zigbee2mqtt
app.kubernetes.io/name: zigbee2mqtt
template:
metadata:
labels:
app.kubernetes.io/component: zigbee2mqtt
app.kubernetes.io/instance: zigbee2mqtt
app.kubernetes.io/name: zigbee2mqtt
app.kubernetes.io/part-of: home-assistant
spec:
nodeSelector:
node-role.kubernetes.io/zigbee-ctrl: ''
tolerations:
- key: du5t1n.me/machine
value: raspberrypi
effect: NoExecute
containers:
- name: zigbee2mqtt
image: docker.io/koenkk/zigbee2mqtt:1.32.1
ports:
- containerPort: 8080
name: http
readinessProbe: &probe
httpGet:
port: 8080
path: /
failureThreshold: 3
periodSeconds: 60
successThreshold: 1
timeoutSeconds: 1
startupProbe:
<<: *probe
failureThreshold: 30
periodSeconds: 3
initialDelaySeconds: 3
securityContext:
runAsUser: 302
runAsGroup: 302
privileged: true
volumeMounts:
- mountPath: /app/data
name: zigbee2mqtt-data
subPath: data
- mountPath: /dev/ttyACM0
name: zigbee-device
securityContext:
fsGroup: 302
volumes:
- name: zigbee2mqtt-data
persistentVolumeClaim:
claimName: zigbee2mqtt
- name: zigbee-device
hostPath:
path: /dev/serial/by-id/usb-dresden_elektronik_ingenieurtechnik_GmbH_ConBee_II_DE2433174-if00
type: CharDevice