juntekim.com/homeassistant/homeassistant.yml
Jun-te Kim ed2a0f2b46 save
2025-12-11 20:19:59 +00:00

139 lines
3.3 KiB
YAML

##############################################
# Persistent Volume (hostPath on mist)
##############################################
apiVersion: v1
kind: PersistentVolume
metadata:
name: homeassistant-pv
spec:
capacity:
storage: 10Gi
volumeMode: Filesystem
accessModes:
- ReadWriteMany
persistentVolumeReclaimPolicy: Retain
storageClassName: homeassistant-local-storage
local:
path: /home/kimjunte/k8s_storage/homeassistant
nodeAffinity:
required:
nodeSelectorTerms:
- matchExpressions:
- key: kubernetes.io/hostname
operator: In
values:
- mist
---
##############################################
# Persistent Volume Claim
##############################################
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: homeassistant-pvc
namespace: default
spec:
accessModes:
- ReadWriteMany
storageClassName: homeassistant-local-storage
resources:
requests:
storage: 10Gi
---
##############################################
# Deployment (Home Assistant Core)
##############################################
apiVersion: apps/v1
kind: Deployment
metadata:
name: homeassistant
namespace: default
labels:
app: homeassistant
spec:
replicas: 1
selector:
matchLabels:
app: homeassistant
template:
metadata:
labels:
app: homeassistant
spec:
# Ensure it runs on the correct node with USB access
nodeSelector:
kubernetes.io/hostname: mist
containers:
- name: homeassistant
image: ghcr.io/home-assistant/home-assistant:stable
# Required for Zigbee USB device access
securityContext:
privileged: true
ports:
- name: http
containerPort: 8123
volumeMounts:
- name: ha-data
mountPath: /config
# Mount Zigbee USB stick (stable ID path)
- name: zigbee-stick
mountPath: /dev/serial/by-id/usb-ITead_Sonoff_Zigbee_3.0_USB_Dongle_Plus_b054318db4a0ef11a724a5a361ce3355-if00-port0
env:
- name: TZ
value: "Europe/London"
volumes:
- name: ha-data
persistentVolumeClaim:
claimName: homeassistant-pvc
# Stable path to Zigbee USB device
- name: zigbee-stick
hostPath:
path: /dev/serial/by-id/usb-ITead_Sonoff_Zigbee_3.0_USB_Dongle_Plus_b054318db4a0ef11a724a5a361ce3355-if00-port0
type: CharDevice
---
##############################################
# Service
##############################################
apiVersion: v1
kind: Service
metadata:
name: homeassistant
namespace: default
spec:
selector:
app: homeassistant
ports:
- protocol: TCP
name: http
port: 8123
targetPort: 8123
---
##############################################
# IngressRoute (Traefik)
##############################################
apiVersion: traefik.io/v1alpha1
kind: IngressRoute
metadata:
name: homeassistant-ingressroute
namespace: default
spec:
entryPoints:
- websecure
routes:
- match: Host(`ha.juntekim.com`)
kind: Rule
services:
- name: homeassistant
port: 8123
tls:
certResolver: myresolver
domains:
- main: ha.juntekim.com