Temporal infrastructure deployment with:
- PostgreSQL StatefulSet (event log + visibility)
- 10Gi PVC, health checks, port 5432
- Elasticsearch StatefulSet (workflow search)
- 20Gi PVC, health checks, port 9200
- Temporal Server StatefulSet (main service)
- Frontend: 7233, Matching: 7235, History: 7234, Worker: 7239
- Headless + ClusterIP services
- Auto-setup image: temporalio/auto-setup:1.20.0
- Temporal UI Deployment (web visualization)
- Port 3000, connects to frontend:7233
- LoadBalancer service for access
Components:
- 00-namespace.yaml: dedicated temporal namespace
- 01-postgres-statefulset.yaml: event log backend
- 02-elasticsearch-statefulset.yaml: search visibility
- 03-temporal-server-statefulset.yaml: server + services
- 04-temporal-ui-deployment.yaml: web ui
- kustomization.yaml: deployment automation
- README.md: deployment + troubleshooting guide
Health checks: liveness + readiness on all components
Persistence: PVCs with dynamic provisioning
Ports: 5432 (postgres), 9200 (es), 7233-7239 (temporal)
Deploy: kubectl apply -k k8s/temporal/
Effort: 150 LOC (complete K8s manifests)
209 lines
4.7 KiB
YAML
209 lines
4.7 KiB
YAML
apiVersion: v1
|
|
kind: ConfigMap
|
|
metadata:
|
|
name: temporal-server-config
|
|
namespace: temporal
|
|
data:
|
|
config.yaml: |
|
|
log:
|
|
stdout: true
|
|
level: info
|
|
|
|
persistence:
|
|
defaultStore: postgres
|
|
visibilityStore: postgres
|
|
numHistoryShards: 4
|
|
storeType: postgres
|
|
postgres:
|
|
user: "postgres"
|
|
password: "temporal-password-changeme"
|
|
host: "temporal-postgres.temporal.svc.cluster.local"
|
|
port: 5432
|
|
maxConns: 20
|
|
maxIdleConns: 20
|
|
maxConnLifetime: 0
|
|
|
|
visibilityDbStore: postgres
|
|
visibilityPersistencePostgres:
|
|
user: "postgres"
|
|
password: "temporal-password-changeme"
|
|
host: "temporal-postgres.temporal.svc.cluster.local"
|
|
port: 5432
|
|
dbName: temporal_visibility
|
|
maxConns: 10
|
|
maxIdleConns: 10
|
|
maxConnLifetime: 0
|
|
|
|
elasticsearch:
|
|
url: "http://temporal-elasticsearch.temporal.svc.cluster.local:9200"
|
|
version: "7"
|
|
indices:
|
|
visibility: temporal_visibility_v1
|
|
|
|
global:
|
|
membership:
|
|
maxJoinDuration: 30s
|
|
broadcastAddress: temporal-server-0.temporal-server.temporal.svc.cluster.local
|
|
port: 7946
|
|
|
|
services:
|
|
frontend:
|
|
rpc:
|
|
grpcPort: 7233
|
|
membershipPort: 7946
|
|
bindOnLocalHost: false
|
|
matching:
|
|
rpc:
|
|
grpcPort: 7235
|
|
membershipPort: 7946
|
|
bindOnLocalHost: false
|
|
history:
|
|
rpc:
|
|
grpcPort: 7234
|
|
membershipPort: 7946
|
|
bindOnLocalHost: false
|
|
worker:
|
|
rpc:
|
|
grpcPort: 7239
|
|
membershipPort: 7946
|
|
bindOnLocalHost: false
|
|
|
|
---
|
|
apiVersion: apps/v1
|
|
kind: StatefulSet
|
|
metadata:
|
|
name: temporal-server
|
|
namespace: temporal
|
|
labels:
|
|
app: temporal-server
|
|
spec:
|
|
serviceName: temporal-server
|
|
replicas: 1
|
|
selector:
|
|
matchLabels:
|
|
app: temporal-server
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app: temporal-server
|
|
spec:
|
|
containers:
|
|
- name: temporal
|
|
image: temporalio/auto-setup:1.20.0
|
|
imagePullPolicy: IfNotPresent
|
|
ports:
|
|
- name: frontend
|
|
containerPort: 7233
|
|
protocol: TCP
|
|
- name: matching
|
|
containerPort: 7235
|
|
protocol: TCP
|
|
- name: history
|
|
containerPort: 7234
|
|
protocol: TCP
|
|
- name: worker
|
|
containerPort: 7239
|
|
protocol: TCP
|
|
- name: metrics
|
|
containerPort: 9090
|
|
protocol: TCP
|
|
env:
|
|
- name: TEMPORAL_STORE_ENGINE
|
|
value: "postgres"
|
|
- name: POSTGRES_USER
|
|
value: "postgres"
|
|
- name: POSTGRES_PWD
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: temporal-postgres-secret
|
|
key: password
|
|
- name: POSTGRES_SEEDS
|
|
value: "temporal-postgres.temporal.svc.cluster.local"
|
|
- name: POSTGRES_PORT
|
|
value: "5432"
|
|
- name: DB
|
|
value: temporal
|
|
- name: VISIBILITY_DB
|
|
value: temporal_visibility
|
|
- name: ELASTICSEARCH_SEEDS
|
|
value: "temporal-elasticsearch.temporal.svc.cluster.local"
|
|
- name: ELASTICSEARCH_PORT
|
|
value: "9200"
|
|
- name: ELASTICSEARCH_VERSION
|
|
value: "7"
|
|
- name: TEMPORAL_NAMESPACE_DOMAIN
|
|
value: "default"
|
|
volumeMounts:
|
|
- name: temporal-config
|
|
mountPath: /etc/temporal
|
|
resources:
|
|
requests:
|
|
cpu: 500m
|
|
memory: 1Gi
|
|
limits:
|
|
cpu: 1000m
|
|
memory: 2Gi
|
|
livenessProbe:
|
|
tcpSocket:
|
|
port: 7233
|
|
initialDelaySeconds: 60
|
|
periodSeconds: 10
|
|
readinessProbe:
|
|
tcpSocket:
|
|
port: 7233
|
|
initialDelaySeconds: 30
|
|
periodSeconds: 5
|
|
volumes:
|
|
- name: temporal-config
|
|
configMap:
|
|
name: temporal-server-config
|
|
|
|
---
|
|
apiVersion: v1
|
|
kind: Service
|
|
metadata:
|
|
name: temporal-server
|
|
namespace: temporal
|
|
labels:
|
|
app: temporal-server
|
|
spec:
|
|
type: ClusterIP
|
|
clusterIP: None # Headless service for StatefulSet
|
|
ports:
|
|
- port: 7233
|
|
targetPort: 7233
|
|
protocol: TCP
|
|
name: frontend
|
|
- port: 7235
|
|
targetPort: 7235
|
|
protocol: TCP
|
|
name: matching
|
|
- port: 7234
|
|
targetPort: 7234
|
|
protocol: TCP
|
|
name: history
|
|
- port: 7239
|
|
targetPort: 7239
|
|
protocol: TCP
|
|
name: worker
|
|
selector:
|
|
app: temporal-server
|
|
|
|
---
|
|
apiVersion: v1
|
|
kind: Service
|
|
metadata:
|
|
name: temporal-frontend
|
|
namespace: temporal
|
|
labels:
|
|
app: temporal-server
|
|
spec:
|
|
type: ClusterIP
|
|
ports:
|
|
- port: 7233
|
|
targetPort: 7233
|
|
protocol: TCP
|
|
name: frontend
|
|
selector:
|
|
app: temporal-server
|