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.
Prerequisites
Section titled “Prerequisites”- A PostgreSQL database (the manifests don’t include one).
- A
wyrmnamespace. - A
wyrm-credssecret with aWYRM_DATABASE_CONNECTIONkey holding the PostgreSQL connection URI.
kubectl create namespace wyrmkubectl -n wyrm create secret generic wyrm-creds \ --from-literal=WYRM_DATABASE_CONNECTION="postgres://wyrm:wyrm@your-db-host/wyrm"Deploy
Section titled “Deploy”apiVersion: v1kind: Servicemetadata: name: wyrm-server namespace: wyrmspec: selector: app: wyrm-server ports: - protocol: "TCP" port: 3001 targetPort: 3001---apiVersion: v1kind: Servicemetadata: name: wyrm-ui namespace: wyrmspec: selector: app: wyrm-ui ports: - protocol: "TCP" port: 3000 targetPort: 3000---apiVersion: apps/v1kind: Deploymentmetadata: name: wyrm-server namespace: wyrmspec: 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/v1kind: Deploymentmetadata: name: wyrm-ui namespace: wyrmspec: 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:
kubectl apply -f kubernetes.yamlSee Server configuration for the other environment variables you can add to the deployments.