homek8s/apps/base/metabase/deployment.yaml

87 lines
2.9 KiB
YAML
Raw Permalink Normal View History

apiVersion: apps/v1
kind: Deployment
metadata:
name: metabase
namespace: metabase
spec:
replicas: 1
selector:
matchLabels:
app: metabase
template:
metadata:
labels:
app: metabase
spec:
# Siriussec is the only gateway node (upstream Envoy has to reach the
# backend pod on the same node), and the CNPG primary is pinned here too.
nodeSelector:
kubernetes.io/hostname: siriussec
tolerations:
- key: dedicated
operator: Exists
effect: PreferNoSchedule
containers:
- name: metabase
# Pinned release tag (2026-11-20, multi-arch). Never latest/nightly:
# Metabase auto-migrates its app DB on start, so an unpinned tag turns
# a pod restart into a schema upgrade.
image: metabase/metabase:v0.65.6.3
imagePullPolicy: IfNotPresent
ports:
- name: http
containerPort: 3000
env:
# One JVM, 1.5 GiB heap, container limit 2 GiB. The laptop is on a
# marginal USB-C supply; a 2 GiB heap here is what starved it in the
# past (see references/laptop-node-power.md).
- name: JAVA_OPTS
value: "-Xmx1536m"
# All state lives in Postgres (no H2 file, no PVC), so the pod is
# disposable and `strategy: Recreate` is unnecessary.
- name: MB_DB_TYPE
value: postgres
- name: MB_DB_HOST
value: pg-rw.metabase.svc.cluster.local
- name: MB_DB_PORT
value: "5432"
- name: MB_DB_DBNAME
value: metabase
- name: MB_DB_USER
valueFrom:
secretKeyRef:
name: pg-app
key: username
- name: MB_DB_PASS
valueFrom:
secretKeyRef:
name: pg-app
key: password
readinessProbe:
httpGet:
path: /api/health
port: 3000
# The JVM takes ~30-60 s to migrate/bootstrap its app DB.
initialDelaySeconds: 20
periodSeconds: 10
timeoutSeconds: 5
failureThreshold: 6
livenessProbe:
httpGet:
path: /api/health
port: 3000
initialDelaySeconds: 120
periodSeconds: 30
timeoutSeconds: 10
failureThreshold: 3
resources:
requests:
cpu: 250m
memory: 1Gi
limits:
# 2 → 1: two Metabase JVMs on the gateway node could together
# burst to 4 threads on a 15 W adapter. 1 core each keeps the
# node inside its power budget; UI latency is unaffected at this
# query volume.
cpu: "1"
memory: 2Gi