Files
poimen-workflows/k8s/temporal/02-elasticsearch-statefulset.yaml
T
poimen 4f51c419a2 feat(phase-1.1): deploy temporal server in k8s
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)
2026-09-08 16:59:15 -07:00

102 lines
2.2 KiB
YAML

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: temporal-elasticsearch-pvc
namespace: temporal
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 20Gi
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: temporal-elasticsearch
namespace: temporal
labels:
app: temporal-elasticsearch
spec:
serviceName: temporal-elasticsearch
replicas: 1
selector:
matchLabels:
app: temporal-elasticsearch
template:
metadata:
labels:
app: temporal-elasticsearch
spec:
containers:
- name: elasticsearch
image: docker.elastic.co/elasticsearch/elasticsearch:7.10.0
ports:
- name: http
containerPort: 9200
protocol: TCP
- name: transport
containerPort: 9300
protocol: TCP
env:
- name: discovery.type
value: single-node
- name: ES_JAVA_OPTS
value: "-Xms512m -Xmx512m"
- name: xpack.security.enabled
value: "false"
volumeMounts:
- name: elasticsearch-storage
mountPath: /usr/share/elasticsearch/data
resources:
requests:
cpu: 250m
memory: 512Mi
limits:
cpu: 500m
memory: 1Gi
livenessProbe:
httpGet:
path: /_cluster/health
port: 9200
initialDelaySeconds: 60
periodSeconds: 10
readinessProbe:
httpGet:
path: /_cluster/health
port: 9200
initialDelaySeconds: 30
periodSeconds: 5
volumeClaimTemplates:
- metadata:
name: elasticsearch-storage
spec:
accessModes: [ "ReadWriteOnce" ]
resources:
requests:
storage: 20Gi
---
apiVersion: v1
kind: Service
metadata:
name: temporal-elasticsearch
namespace: temporal
labels:
app: temporal-elasticsearch
spec:
type: ClusterIP
clusterIP: None # Headless service for StatefulSet
ports:
- port: 9200
targetPort: 9200
protocol: TCP
name: http
- port: 9300
targetPort: 9300
protocol: TCP
name: transport
selector:
app: temporal-elasticsearch