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,110 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
labels:
app.kubernetes.io/component: zwavejs2mqtt
app.kubernetes.io/instance: zwavejs2mqtt
app.kubernetes.io/name: zwavejs2mqtt
app.kubernetes.io/part-of: home-assistant
name: zwavejs2mqtt
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
---
apiVersion: v1
kind: Service
metadata:
labels:
app.kubernetes.io/component: zwavejs2mqtt
app.kubernetes.io/instance: zwavejs2mqtt
app.kubernetes.io/name: zwavejs2mqtt
app.kubernetes.io/part-of: home-assistant
name: zwavejs2mqtt
spec:
ports:
- port: 8091
name: http
- port: 3000
name: ws
selector:
app.kubernetes.io/component: zwavejs2mqtt
app.kubernetes.io/instance: zwavejs2mqtt
app.kubernetes.io/name: zwavejs2mqtt
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
labels:
app.kubernetes.io/component: zwavejs2mqtt
app.kubernetes.io/instance: zwavejs2mqtt
app.kubernetes.io/name: zwavejs2mqtt
app.kubernetes.io/part-of: home-assistant
name: zwavejs2mqtt
spec:
serviceName: zwavejs2mqtt
selector:
matchLabels:
app.kubernetes.io/component: zwavejs2mqtt
app.kubernetes.io/instance: zwavejs2mqtt
app.kubernetes.io/name: zwavejs2mqtt
template:
metadata:
labels:
app.kubernetes.io/component: zwavejs2mqtt
app.kubernetes.io/instance: zwavejs2mqtt
app.kubernetes.io/name: zwavejs2mqtt
app.kubernetes.io/part-of: home-assistant
spec:
nodeSelector:
node-role.kubernetes.io/zwave-ctrl: ''
tolerations:
- key: du5t1n.me/machine
value: raspberrypi
effect: NoExecute
containers:
- name: zwavejs2mqtt
image: docker.io/zwavejs/zwavejs2mqtt:8.20.0
ports:
- containerPort: 8091
name: http
- containerPort: 3000
name: ws
readinessProbe: &probe
httpGet:
port: 8091
path: /health/zwave
failureThreshold: 3
periodSeconds: 60
successThreshold: 1
timeoutSeconds: 1
startupProbe:
<<: *probe
failureThreshold: 30
periodSeconds: 3
initialDelaySeconds: 3
securityContext:
privileged: true
readOnlyRootFilesystem: true
runAsGroup: 303
runAsUser: 303
volumeMounts:
- mountPath: /usr/src/app/store
name: zwavejs2mqtt-data
subPath: data
- mountPath: /dev/ttyUSB0
name: zwave-device
securityContext:
fsGroup: 303
volumes:
- name: zwavejs2mqtt-data
persistentVolumeClaim:
claimName: zwavejs2mqtt
- name: zwave-device
hostPath:
path: /dev/serial/by-id/usb-Silicon_Labs_CP2102N_USB_to_UART_Bridge_Controller_98c39ad72c45eb1193dfa552b003b68c-if00-port0
type: CharDevice