infisical: bring self-hosted stack under GitOps (postgres, valkey, backend); secret.yaml excluded template

This commit is contained in:
2026-07-16 21:47:28 +02:00
parent 1d026f8d57
commit 37737670b5
11 changed files with 248 additions and 30 deletions

View File

@@ -1,18 +0,0 @@
apiVersion: discovery.k8s.io/v1
kind: EndpointSlice
metadata:
name: infisical
namespace: infisical
labels:
kubernetes.io/service-name: infisical
addressType: IPv4
ports:
- port: 8080
protocol: TCP
endpoints:
- addresses:
- "10.8.11.98"
conditions:
ready: true
serving: true
terminating: false

View File

@@ -1,11 +0,0 @@
apiVersion: v1
kind: Service
metadata:
name: infisical
namespace: infisical
spec:
ports:
- protocol: TCP
port: 8080
targetPort: 8080
type: ClusterIP

View File

@@ -0,0 +1,72 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: infisical-backend
namespace: infisical
spec:
replicas: 1
selector:
matchLabels:
app: infisical-backend
strategy:
type: RollingUpdate
rollingUpdate:
maxUnavailable: 0
template:
metadata:
labels:
app: infisical-backend
spec:
# The backend runs DB migrations on startup, so wait for Postgres to be ready.
initContainers:
- name: wait-for-db
image: postgres:14-alpine
command:
- sh
- -c
- "until pg_isready -h infisical-postgres -p 5432 -U $POSTGRES_USER; do echo waiting for db; sleep 2; done"
env:
- name: POSTGRES_USER
valueFrom:
secretKeyRef:
name: infisical-secrets
key: POSTGRES_USER
containers:
- name: backend
image: infisical/infisical:v0.162.6 # pinned — bump deliberately
ports:
- containerPort: 8080
# ENCRYPTION_KEY, AUTH_SECRET, DB_CONNECTION_URI, REDIS_URL (+ POSTGRES_* — ignored) come from the Secret
envFrom:
- secretRef:
name: infisical-secrets
env:
- name: NODE_ENV
value: production
- name: SITE_URL
value: https://infisical.jsme.be
- name: OTEL_TELEMETRY_COLLECTION_ENABLED
value: "false"
# Allow Core to reach the in-cluster Kubernetes API (kubernetes.default.svc,
# a private ClusterIP) for Kubernetes Auth token review. Off by default (SSRF guard).
- name: ALLOW_INTERNAL_IP_CONNECTIONS
value: "true"
readinessProbe:
httpGet:
path: /api/status
port: 8080
initialDelaySeconds: 20
periodSeconds: 10
failureThreshold: 12
livenessProbe:
httpGet:
path: /api/status
port: 8080
initialDelaySeconds: 60
periodSeconds: 20
resources:
requests:
cpu: 250m
memory: 512Mi
limits:
memory: 1Gi

View File

@@ -0,0 +1,14 @@
apiVersion: v1
kind: Service
metadata:
name: infisical-backend
namespace: infisical
labels:
app: infisical-backend
spec:
selector:
app: infisical-backend
ports:
- name: http
port: 8080
targetPort: 8080

View File

@@ -0,0 +1,4 @@
apiVersion: v1
kind: Namespace
metadata:
name: infisical

View File

@@ -0,0 +1,14 @@
apiVersion: v1
kind: Service
metadata:
name: infisical-postgres
namespace: infisical
labels:
app: infisical-postgres
spec:
selector:
app: infisical-postgres
ports:
- name: postgres
port: 5432
targetPort: 5432

View File

@@ -0,0 +1,64 @@
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: infisical-postgres
namespace: infisical
spec:
serviceName: infisical-postgres
replicas: 1
selector:
matchLabels:
app: infisical-postgres
template:
metadata:
labels:
app: infisical-postgres
spec:
containers:
- name: postgres
image: postgres:14-alpine
ports:
- containerPort: 5432
env:
# Keep data in a subdir so an RWO volume's lost+found doesn't block initdb
- name: PGDATA
value: /var/lib/postgresql/data/pgdata
- name: POSTGRES_USER
valueFrom:
secretKeyRef:
name: infisical-secrets
key: POSTGRES_USER
- name: POSTGRES_PASSWORD
valueFrom:
secretKeyRef:
name: infisical-secrets
key: POSTGRES_PASSWORD
- name: POSTGRES_DB
valueFrom:
secretKeyRef:
name: infisical-secrets
key: POSTGRES_DB
volumeMounts:
- name: data
mountPath: /var/lib/postgresql/data
readinessProbe:
exec:
command: ["sh", "-c", "pg_isready -U $POSTGRES_USER -d $POSTGRES_DB"]
initialDelaySeconds: 5
periodSeconds: 5
timeoutSeconds: 10
failureThreshold: 10
livenessProbe:
exec:
command: ["sh", "-c", "pg_isready -U $POSTGRES_USER -d $POSTGRES_DB"]
initialDelaySeconds: 30
periodSeconds: 15
volumeClaimTemplates:
- metadata:
name: data
spec:
accessModes: ["ReadWriteOnce"]
storageClassName: longhorn
resources:
requests:
storage: 8Gi

View File

@@ -0,0 +1,23 @@
# ⚠️ BOOTSTRAP SECRETS — do NOT commit this file to Git in plaintext.
# Infisical can't manage its own bootstrap secrets (chicken/egg), so these live
# in a plain Secret. Manage via SOPS/sealed-secrets or `kubectl create secret`
# out-of-band. Values below were randomly generated for you.
#
# ENCRYPTION_KEY : openssl rand -hex 16
# AUTH_SECRET : openssl rand -base64 32
#
# DB_CONNECTION_URI password MUST match POSTGRES_PASSWORD.
apiVersion: v1
kind: Secret
metadata:
name: infisical-secrets
namespace: infisical
type: Opaque
stringData:
ENCRYPTION_KEY: ""
AUTH_SECRET: ""
POSTGRES_USER: ""
POSTGRES_PASSWORD: ""
POSTGRES_DB: ""
DB_CONNECTION_URI: ""
REDIS_URL: ""

View File

@@ -0,0 +1,14 @@
apiVersion: v1
kind: Service
metadata:
name: infisical-valkey
namespace: infisical
labels:
app: infisical-valkey
spec:
selector:
app: infisical-valkey
ports:
- name: valkey
port: 6379
targetPort: 6379

View File

@@ -0,0 +1,40 @@
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: infisical-valkey
namespace: infisical
spec:
serviceName: infisical-valkey
replicas: 1
selector:
matchLabels:
app: infisical-valkey
template:
metadata:
labels:
app: infisical-valkey
spec:
containers:
- name: valkey
# Valkey is a drop-in, Redis-protocol-compatible replacement for Redis.
image: valkey/valkey:8-alpine
args: ["--appendonly", "yes"]
ports:
- containerPort: 6379
volumeMounts:
- name: data
mountPath: /data
readinessProbe:
exec:
command: ["valkey-cli", "ping"]
initialDelaySeconds: 5
periodSeconds: 10
volumeClaimTemplates:
- metadata:
name: data
spec:
accessModes: ["ReadWriteOnce"]
storageClassName: longhorn
resources:
requests:
storage: 1Gi

View File

@@ -11,7 +11,9 @@ spec:
targetRevision: HEAD
directory:
recurse: true
exclude: universal-auth-secret.yaml
# secret.yaml holds Infisical's own bootstrap secrets — applied out-of-band,
# committed here only as an emptied template. Never let ArgoCD apply it.
exclude: secret.yaml
destination:
server: https://kubernetes.default.svc
namespace: infisical