Home Assistant & Setup for 2nd try of Cobalt
This commit is contained in:
parent
88cd90b41b
commit
f610eace1f
|
|
@ -0,0 +1,121 @@
|
|||
---
|
||||
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
|
||||
|
|
@ -0,0 +1,150 @@
|
|||
apiVersion: v1
|
||||
kind: Namespace
|
||||
metadata:
|
||||
name: cobalt-downloader
|
||||
---
|
||||
# 1. THE BACKEND API (Processing Engine)
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: cobalt-api
|
||||
namespace: cobalt-downloader
|
||||
labels:
|
||||
app: cobalt-api
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: cobalt-api
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: cobalt-api
|
||||
spec:
|
||||
containers:
|
||||
- name: api
|
||||
image: ghcr.io/imputnet/cobalt:latest
|
||||
imagePullPolicy: IfNotPresent
|
||||
ports:
|
||||
- containerPort: 9000
|
||||
name: http-api
|
||||
env:
|
||||
# Identifies its own public API endpoint location
|
||||
- name: API_URL
|
||||
value: "https://cobalt-api.needlestack.boo"
|
||||
# Grants cross-origin clearance strictly to your web UI subdomain
|
||||
- name: CORS_ALLOWED_ORIGINS
|
||||
value: "https://cobalt.needlestack.boo"
|
||||
resources:
|
||||
limits:
|
||||
cpu: "500m"
|
||||
memory: "512Mi"
|
||||
requests:
|
||||
cpu: "100m"
|
||||
memory: "128Mi"
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: cobalt-api-svc
|
||||
namespace: cobalt-downloader
|
||||
spec:
|
||||
selector:
|
||||
app: cobalt-api
|
||||
ports:
|
||||
- protocol: TCP
|
||||
port: 9000
|
||||
targetPort: 9000
|
||||
---
|
||||
# 2. THE WEB FRONTEND UI (Browser Dashboard)
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: cobalt-web
|
||||
namespace: cobalt-downloader
|
||||
labels:
|
||||
app: cobalt-web
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: cobalt-web
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: cobalt-web
|
||||
spec:
|
||||
containers:
|
||||
- name: web
|
||||
# Swapped to the official, verified web UI container path
|
||||
image: ghcr.io/imputnet/cobalt-web:latest
|
||||
imagePullPolicy: IfNotPresent
|
||||
ports:
|
||||
- containerPort: 80
|
||||
name: http-web
|
||||
env:
|
||||
# CORRECTED: Official SvelteKit container variable mapping the API to your browser
|
||||
- name: WEB_DEFAULT_API
|
||||
value: "https://cobalt-api.needlestack.boo"
|
||||
resources:
|
||||
limits:
|
||||
cpu: "500m"
|
||||
memory: "512Mi"
|
||||
requests:
|
||||
cpu: "50m"
|
||||
memory: "128Mi"
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: cobalt-web-svc
|
||||
namespace: cobalt-downloader
|
||||
spec:
|
||||
selector:
|
||||
app: cobalt-web
|
||||
ports:
|
||||
- protocol: TCP
|
||||
port: 80
|
||||
targetPort: 80
|
||||
---
|
||||
# 3. NGINX INGRESS MAPPING (Dual Host Control)
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: cobalt-ingress
|
||||
namespace: cobalt-downloader
|
||||
annotations:
|
||||
cert-manager.io/cluster-issuer: "letsencrypt-production"
|
||||
nginx.ingress.kubernetes.io/backend-protocol: "HTTP"
|
||||
nginx.ingress.kubernetes.io/ssl-redirect: "true"
|
||||
# REMOVED: nginx-cors injection removed to prevent browser-side "Double CORS header" conflicts
|
||||
spec:
|
||||
ingressClassName: nginx
|
||||
tls:
|
||||
- secretName: cobalt-tls-secret
|
||||
hosts:
|
||||
- cobalt.needlestack.boo
|
||||
- cobalt-api.needlestack.boo
|
||||
rules:
|
||||
# Routes your primary browser landing screen traffic
|
||||
- host: cobalt.needlestack.boo
|
||||
http:
|
||||
paths:
|
||||
- path: /
|
||||
pathType: Prefix
|
||||
backend:
|
||||
service:
|
||||
name: cobalt-web-svc
|
||||
port:
|
||||
number: 80
|
||||
# Routes underlying stream data traffic
|
||||
- host: cobalt-api.needlestack.boo
|
||||
http:
|
||||
paths:
|
||||
- path: /
|
||||
pathType: Prefix
|
||||
backend:
|
||||
service:
|
||||
name: cobalt-api-svc
|
||||
port:
|
||||
number: 9000
|
||||
Loading…
Reference in New Issue