Kubernetes
Termix runs as one pod.
Run one replica. Each pod keeps its own sign in rate limits, step up checks and plugin processes, so with more than one pod the limits count per pod and plugin jobs, like alert checks, run on every pod. If you still run more than one, use PostgreSQL or MySQL, send each user to the same pod, and set REDIS_URL so Session Sharing keeps its live state across pods.
Manifests
Save this as termix.yaml, change the storage size and image tag if you want, then apply it.
apiVersion: v1
kind: Namespace
metadata:
name: termix
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: termix-data
namespace: termix
spec:
accessModes: [ReadWriteOnce]
resources:
requests:
storage: 5Gi
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: termix
namespace: termix
spec:
replicas: 1
strategy:
type: Recreate
selector:
matchLabels:
app: termix
template:
metadata:
labels:
app: termix
spec:
containers:
- name: termix
image: ghcr.io/termix-ssh/termix:latest
ports:
- containerPort: 8080
env:
- name: PORT
value: "8080"
volumeMounts:
- name: data
mountPath: /app/data
readinessProbe:
httpGet:
path: /health
port: 8080
initialDelaySeconds: 20
volumes:
- name: data
persistentVolumeClaim:
claimName: termix-data
---
apiVersion: v1
kind: Service
metadata:
name: termix
namespace: termix
spec:
selector:
app: termix
ports:
- port: 8080
targetPort: 8080
kubectl apply -f termix.yaml
kubectl -n termix port-forward svc/termix 8080:8080
Open http://localhost:8080 and do the first run.
To use your own guacd for remote desktop, run it as a second container in the same pod and see External guacd.
Expose it
Nothing is reachable from outside the cluster yet. Add an Ingress in front of the Service, and make sure it passes WebSockets through. With ingress-nginx:
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: termix
namespace: termix
annotations:
nginx.ingress.kubernetes.io/proxy-read-timeout: "3600"
nginx.ingress.kubernetes.io/proxy-send-timeout: "3600"
nginx.ingress.kubernetes.io/proxy-body-size: "0"
spec:
ingressClassName: nginx
rules:
- host: termix.example.com
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: termix
port:
number: 8080
Set TRUSTED_PROXIES to your ingress controller's pod range so logs and the audit log show real client IPs. See reverse proxy.
Secrets
By default Termix makes its keys on first boot and keeps them in the data volume. To keep them in Kubernetes Secrets instead, mount them as files and point JWT_SECRET_FILE, DATABASE_KEY_FILE, ENCRYPTION_KEY_FILE and INTERNAL_AUTH_TOKEN_FILE at them. See security.
Harden the pod
From Termix 26.11.2 the pod can run as a fixed user with every capability dropped and a read-only root filesystem. Add this to the termix container and give it a writable /tmp:
securityContext:
runAsUser: 1000
runAsGroup: 1000
readOnlyRootFilesystem: true
allowPrivilegeEscalation: false
capabilities:
drop: ["ALL"]
volumeMounts:
- name: data
mountPath: /app/data
- name: tmp
mountPath: /tmp
securityContext:
fsGroup: 1000
sysctls:
- name: net.ipv4.ping_group_range
value: "0 2147483647"
volumes:
- name: tmp
emptyDir: {}
fsGroup makes the data volume writable for that user. The ping_group_range sysctl lets the Uptime plugin ping without a capability; it is a safe sysctl, so no cluster setting is needed. See harden the container for what each part does.