Matrix synapse deployment

This commit is contained in:
2025-12-22 10:45:24 +01:00
parent 45b4768910
commit e3b6d23d55
4 changed files with 151 additions and 0 deletions

View File

@@ -0,0 +1,58 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: matrix-server-deployment
labels:
matrix-service: server
spec:
replicas: 1
selector:
matchLabels:
matrix-service: server
template:
metadata:
labels:
matrix-service: server
spec:
containers:
- name: matrix-server
image: matrixdotorg/synapse:latest
# imagePullPolicy: IfNotPresent
ports:
- containerPort: 8008
name: http-matrix
protocol: TCP
readinessProbe:
failureThreshold: 3
httpGet:
path: /_matrix/static
port: 8008
scheme: HTTP
initialDelaySeconds: 5
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 2
livenessProbe:
failureThreshold: 3
initialDelaySeconds: 45
periodSeconds: 5
successThreshold: 1
httpGet:
path: /_matrix/static
port: 8008
scheme: HTTP
timeoutSeconds: 1
volumeMounts:
- name: matrix-synapse-data
mountPath: /data
volumes:
- name: matrix-synapse-data
persistentVolumeClaim:
claimName: matrix-synapse-data-pvc
readOnly: false

View File

@@ -0,0 +1,60 @@
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: matrix-server-networkpolicy
spec:
podSelector:
matchLabels:
matrix-service: server
egress:
# Allow all egress
# - {}
- to:
- ipBlock:
# Address of a PSQL server
cidr: 1.2.3.4/32
ports:
- protocol: TCP
port: 5432
- to:
- namespaceSelector:
matchLabels:
kubernetes.io/metadata.name: kube-system
podSelector:
matchLabels:
k8s-app: kube-dns
ports:
- protocol: UDP
port: 53
- protocol: TCP
port: 53
- to:
- ipBlock:
cidr: 0.0.0.0/0
except:
- 10.0.0.0/8
- 172.16.0.0/12
- 192.168.0.0/16
ingress:
# optional reverse proxy
# - from:
# - namespaceSelector:
# matchLabels:
# ns-name: <NS>
# podSelector:
# matchLabels:
# podDomain: <podLabel>
# ports:
# - protocol: TCP
# port: 8008
policyTypes:
- Ingress
- Egress

15
MatrixSynapse/pvc.yaml Normal file
View File

@@ -0,0 +1,15 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: matrix-synapse-data-pvc
labels:
matrix-server-domain: example.me
spec:
# https://kubernetes.io/docs/concepts/storage/persistent-volumes/#access-modes-1
accessModes:
# - ReadOnlyMany
- ReadWriteOnce
# - ReadWriteMany
resources:
requests:
storage: 16Gi

View File

@@ -0,0 +1,18 @@
apiVersion: v1
kind: Service
metadata:
name: matrix-server-service
labels:
matrix-service: server
spec:
selector:
matrix-service: server
# This isn't used as Ingress is doing TLS termination
# type: LoadBalancer
type: ClusterIP
ports:
- name: matrix-server-http
appProtocol: TCP
port: 8008 # <- port that will be exposed