Skip to content

Kubernetes

The manifests below define a Deployment and Service for both wyrm-server (port 3001) and wyrm-ui (port 3000). They’re also in templates/kubernetes.yaml on GitHub.

  • A PostgreSQL database (the manifests don’t include one).
  • A wyrm namespace.
  • A wyrm-creds secret with a WYRM_DATABASE_CONNECTION key holding the PostgreSQL connection URI.
Terminal window
kubectl create namespace wyrm
kubectl -n wyrm create secret generic wyrm-creds \
--from-literal=WYRM_DATABASE_CONNECTION="postgres://wyrm:wyrm@your-db-host/wyrm"
kubernetes.yaml
apiVersion: v1
kind: Service
metadata:
name: wyrm-server
namespace: wyrm
spec:
selector:
app: wyrm-server
ports:
- protocol: "TCP"
port: 3001
targetPort: 3001
---
apiVersion: v1
kind: Service
metadata:
name: wyrm-ui
namespace: wyrm
spec:
selector:
app: wyrm-ui
ports:
- protocol: "TCP"
port: 3000
targetPort: 3000
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: wyrm-server
namespace: wyrm
spec:
selector:
matchLabels:
app: wyrm-server
replicas: 1
template:
metadata:
labels:
app: wyrm-server
spec:
securityContext:
runAsNonRoot: true
runAsUser: 1000
runAsGroup: 1000
containers:
- name: wyrm-server
image: ghcr.io/wyrmrss/wyrm-server:latest
imagePullPolicy: Always
securityContext:
privileged: false
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL
ports:
- containerPort: 3001
env:
- name: WYRM_DATABASE_CONNECTION
valueFrom:
secretKeyRef:
name: wyrm-creds
key: WYRM_DATABASE_CONNECTION
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: wyrm-ui
namespace: wyrm
spec:
selector:
matchLabels:
app: wyrm-ui
replicas: 1
template:
metadata:
labels:
app: wyrm-ui
spec:
securityContext:
runAsNonRoot: true
runAsUser: 1000
runAsGroup: 1000
containers:
- name: wyrm-ui
image: ghcr.io/wyrmrss/wyrm-ui:latest
imagePullPolicy: Always
securityContext:
privileged: false
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL
volumeMounts:
- name: nginx-conf
mountPath: /etc/nginx/conf.d
ports:
- containerPort: 3000
env:
- name: WYRM_BACKEND_URL
value: "http://wyrm-server:3001"
volumes:
- name: nginx-conf
emptyDir: {}

Save it as kubernetes.yaml and apply it:

Terminal window
kubectl apply -f kubernetes.yaml

See Server configuration for the other environment variables you can add to the deployments.