119 lines
2.7 KiB
YAML
119 lines
2.7 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:
|
|
nodeSelector:
|
|
kubernetes.io/hostname: mist
|
|
containers:
|
|
- name: homeassistant
|
|
image: ghcr.io/home-assistant/home-assistant:stable
|
|
ports:
|
|
- name: http
|
|
containerPort: 8123
|
|
volumeMounts:
|
|
- name: ha-data
|
|
mountPath: /config
|
|
env:
|
|
- name: TZ
|
|
value: "Europe/London"
|
|
volumes:
|
|
- name: ha-data
|
|
persistentVolumeClaim:
|
|
claimName: homeassistant-pvc
|
|
---
|
|
##############################################
|
|
# 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
|