Skip to main content

Kubernetes

To run the Electric sync service in Kubernetes deploy the Docker image within a Pod, usually via a Deployment.

The container image needs ports 5133, 5433 and 65432 exposed and the environment variables described in API -> Sync service configured.

For example:

# electric-deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: electric-deployment
labels:
app: electric
spec:
replicas: 1
selector:
matchLabels:
app: electric
template:
metadata:
labels:
app: electric
spec:
containers:
- name: electric
image: electricsql/electric:latest
env:
- name: DATABASE_URL
value: "postgresql://..."
- name: ELECTRIC_WRITE_TO_PG_MODE
value: "direct_writes"
- name: PG_PROXY_PASSWORD
value: "..."
- name: AUTH_JWT_ALG
value: "HS512"
- name: AUTH_JWT_KEY
value: "..."
ports:
- name: satellite-http
containerPort: 5133
- name: logical-pub-tcp
containerPort: 5433
- name: pg-proxy-tcp
containerPort: 65432

You can organise a deployment of Electric with Postgres and any other services using a Helm chart.