cluster-manifests/automation/home-assistant.yaml

122 lines
2.9 KiB
YAML

---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: homeassistant-config-pvc
namespace: automation
spec:
accessModes:
- ReadWriteOnce
storageClassName: longhorn
resources:
requests:
storage: 10Gi
---
apiVersion: v1
kind: Service
metadata:
name: homeassistant-svc
namespace: automation
labels:
app.kubernetes.io/name: homeassistant
spec:
type: ClusterIP
ports:
- name: http
port: 8123
targetPort: 8123
protocol: TCP
selector:
app.kubernetes.io/name: homeassistant
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: homeassistant
namespace: automation
labels:
app.kubernetes.io/name: homeassistant
spec:
replicas: 1
strategy:
type: Recreate
selector:
matchLabels:
app.kubernetes.io/name: homeassistant
template:
metadata:
labels:
app.kubernetes.io/name: homeassistant
spec:
hostNetwork: true
dnsPolicy: ClusterFirstWithHostNet
containers:
- name: homeassistant
image: ghcr.io/home-assistant/home-assistant:stable
imagePullPolicy: IfNotPresent
securityContext:
capabilities:
add:
- NET_ADMIN
- NET_RAW
env:
- name: TZ
value: "Europe/London"
ports:
- name: http
containerPort: 8123
hostPort: 8123
protocol: TCP
volumeMounts:
- name: config-volume
mountPath: /config
# This blocks traffic from hitting the container until it has fully read configuration.yaml
readinessProbe:
httpGet:
path: /manifest.json
port: 8123
initialDelaySeconds: 45
periodSeconds: 10
timeoutSeconds: 5
failureThreshold: 6
resources:
requests:
cpu: "200m"
memory: "512Mi"
limits:
cpu: "1000m"
memory: "2Gi"
volumes:
- name: config-volume
persistentVolumeClaim:
claimName: homeassistant-config-pvc
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: homeassistant-ingress
namespace: automation
annotations:
cert-manager.io/cluster-issuer: "letsencrypt-production"
nginx.ingress.kubernetes.io/proxy-body-size: "0"
nginx.ingress.kubernetes.io/proxy-http-version: "1.1"
nginx.ingress.kubernetes.io/proxy-read-timeout: "3600"
nginx.ingress.kubernetes.io/proxy-send-timeout: "3600"
spec:
ingressClassName: nginx
tls:
- hosts:
- smart.needlestack.boo
secretName: smart-needlestack-boo-tls
rules:
- host: smart.needlestack.boo
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: homeassistant-svc
port:
number: 8123