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,114 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
labels:
app.kubernetes.io/component: mosquitto
app.kubernetes.io/instance: mosquitto
app.kubernetes.io/name: mosquitto
app.kubernetes.io/part-of: home-assistant
name: mosquitto
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 6Gi
---
apiVersion: v1
kind: Service
metadata:
labels:
app.kubernetes.io/component: mosquitto
app.kubernetes.io/instance: mosquitto
app.kubernetes.io/name: mosquitto
app.kubernetes.io/part-of: home-assistant
name: mosquitto
spec:
ports:
- port: 8883
name: mqtt
nodePort: 30783
selector:
app.kubernetes.io/component: mosquitto
app.kubernetes.io/instance: mosquitto
app.kubernetes.io/name: mosquitto
type: NodePort
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
labels:
app.kubernetes.io/component: mosquitto
app.kubernetes.io/instance: mosquitto
app.kubernetes.io/name: mosquitto
app.kubernetes.io/part-of: home-assistant
name: mosquitto
spec:
serviceName: mosquitto
selector:
matchLabels:
app.kubernetes.io/component: mosquitto
app.kubernetes.io/instance: mosquitto
app.kubernetes.io/name: mosquitto
template:
metadata:
labels:
app.kubernetes.io/component: mosquitto
app.kubernetes.io/instance: mosquitto
app.kubernetes.io/name: mosquitto
app.kubernetes.io/part-of: home-assistant
spec:
containers:
- name: mosquitto
image: docker.io/library/eclipse-mosquitto:2.0.15
ports:
- containerPort: 8883
name: mqtt
readinessProbe: &probe
tcpSocket:
port: 8883
failureThreshold: 3
periodSeconds: 60
successThreshold: 1
timeoutSeconds: 1
startupProbe:
<<: *probe
failureThreshold: 30
periodSeconds: 1
securityContext:
runAsUser: 300
runAsGroup: 300
volumeMounts:
- mountPath: /mosquitto/config/mosquitto.conf
name: mosquitto-config
subPath: mosquitto.conf
- mountPath: /mosquitto/config/passwd
name: mosquitto-passwd
subPath: passwd
- mountPath: /mosquitto/data
name: mosquitto-data
subPath: data
- mountPath: /mosquitto/log
name: mosquitto-log
subPath: log
- mountPath: /run/secrets/mosquitto
name: mosquitto-cert
securityContext:
fsGroup: 300
volumes:
- name: mosquitto-cert
secret:
secretName: mosquitto-cert
- name: mosquitto-config
configMap:
name: mosquitto
- name: mosquitto-data
persistentVolumeClaim:
claimName: mosquitto
- name: mosquitto-log
emptyDir: {}
- name: mosquitto-passwd
secret:
secretName: mosquitto