From fb683854a4ee23ee81a84fc746ae4878db40afdb Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Wed, 6 Aug 2025 00:03:13 +0300 Subject: add syncthing --- f3s/syncthing/Makefile | 12 ++++++++ f3s/syncthing/README.md | 20 +++++++++++++ f3s/syncthing/deployment.yaml | 33 ++++++++++++++++++++++ f3s/syncthing/ingress.yaml | 20 +++++++++++++ f3s/syncthing/namespace.yaml | 4 +++ f3s/syncthing/persistent-volume.yaml | 55 ++++++++++++++++++++++++++++++++++++ f3s/syncthing/service.yaml | 19 +++++++++++++ 7 files changed, 163 insertions(+) create mode 100644 f3s/syncthing/Makefile create mode 100644 f3s/syncthing/README.md create mode 100644 f3s/syncthing/deployment.yaml create mode 100644 f3s/syncthing/ingress.yaml create mode 100644 f3s/syncthing/namespace.yaml create mode 100644 f3s/syncthing/persistent-volume.yaml create mode 100644 f3s/syncthing/service.yaml diff --git a/f3s/syncthing/Makefile b/f3s/syncthing/Makefile new file mode 100644 index 0000000..a3b12c2 --- /dev/null +++ b/f3s/syncthing/Makefile @@ -0,0 +1,12 @@ +apply: + kubectl apply -f namespace.yaml + kubectl apply -f persistent-volume.yaml + kubectl apply -f service.yaml + kubectl apply -f deployment.yaml + kubectl apply -f ingress.yaml + +delete: + kubectl delete -f ingress.yaml + kubectl delete -f service.yaml + kubectl delete -f deployment.yaml + kubectl delete -f persistent-volume.yaml diff --git a/f3s/syncthing/README.md b/f3s/syncthing/README.md new file mode 100644 index 0000000..3e2344a --- /dev/null +++ b/f3s/syncthing/README.md @@ -0,0 +1,20 @@ +# Syncthing Kubernetes Deployment + +This directory contains the Kubernetes configuration for deploying Syncthing. + +## Deployment + +To deploy Syncthing, apply the Kubernetes manifests in this directory: + +```bash +make apply +``` + +## Configuration + +The deployment uses two persistent volumes: +- `syncthing-config-pv`: for the syncthing configuration. Mapped to `/data/nfs/k3svolumes/syncthing/config` on the host. +- `syncthing-data-pv`: for the syncthing data. Mapped to `/data/nfs/k3svolumes/syncthing/data` on the host. + +The web UI is available at http://syncthing.f3s.buetow.org. +The data port is exposed on port 22000. diff --git a/f3s/syncthing/deployment.yaml b/f3s/syncthing/deployment.yaml new file mode 100644 index 0000000..9a85a17 --- /dev/null +++ b/f3s/syncthing/deployment.yaml @@ -0,0 +1,33 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: syncthing + namespace: services +spec: + replicas: 1 + selector: + matchLabels: + app: syncthing + template: + metadata: + labels: + app: syncthing + spec: + containers: + - name: syncthing + image: lscr.io/linuxserver/syncthing:latest + ports: + - containerPort: 8384 + - containerPort: 22000 + volumeMounts: + - name: syncthing-config + mountPath: /config + - name: syncthing-data + mountPath: /data + volumes: + - name: syncthing-config + persistentVolumeClaim: + claimName: syncthing-config-pvc + - name: syncthing-data + persistentVolumeClaim: + claimName: syncthing-data-pvc diff --git a/f3s/syncthing/ingress.yaml b/f3s/syncthing/ingress.yaml new file mode 100644 index 0000000..b1e68e1 --- /dev/null +++ b/f3s/syncthing/ingress.yaml @@ -0,0 +1,20 @@ +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: syncthing-ingress + namespace: services + annotations: + spec.ingressClassName: traefik + traefik.ingress.kubernetes.io/router.entrypoints: web +spec: + rules: + - host: syncthing.f3s.buetow.org + http: + paths: + - path: / + pathType: Prefix + backend: + service: + name: syncthing-service + port: + number: 8384 diff --git a/f3s/syncthing/namespace.yaml b/f3s/syncthing/namespace.yaml new file mode 100644 index 0000000..da390d0 --- /dev/null +++ b/f3s/syncthing/namespace.yaml @@ -0,0 +1,4 @@ +apiVersion: v1 +kind: Namespace +metadata: + name: services diff --git a/f3s/syncthing/persistent-volume.yaml b/f3s/syncthing/persistent-volume.yaml new file mode 100644 index 0000000..793ae60 --- /dev/null +++ b/f3s/syncthing/persistent-volume.yaml @@ -0,0 +1,55 @@ +apiVersion: v1 +kind: PersistentVolume +metadata: + name: syncthing-config-pv +spec: + capacity: + storage: 1Gi + volumeMode: Filesystem + accessModes: + - ReadWriteOnce + persistentVolumeReclaimPolicy: Retain + hostPath: + path: /data/nfs/k3svolumes/syncthing/config + type: Directory +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: syncthing-config-pvc + namespace: services +spec: + storageClassName: "" + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 1Gi +--- +apiVersion: v1 +kind: PersistentVolume +metadata: + name: syncthing-data-pv +spec: + capacity: + storage: 300Gi + volumeMode: Filesystem + accessModes: + - ReadWriteOnce + persistentVolumeReclaimPolicy: Retain + hostPath: + path: /data/nfs/k3svolumes/syncthing/data + type: Directory +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: syncthing-data-pvc + namespace: services +spec: + storageClassName: "" + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 300Gi \ No newline at end of file diff --git a/f3s/syncthing/service.yaml b/f3s/syncthing/service.yaml new file mode 100644 index 0000000..74bf5ed --- /dev/null +++ b/f3s/syncthing/service.yaml @@ -0,0 +1,19 @@ +apiVersion: v1 +kind: Service +metadata: + labels: + app: syncthing + name: syncthing-service + namespace: services +spec: + ports: + - name: web + port: 8384 + protocol: TCP + targetPort: 8384 + - name: data + port: 22000 + protocol: TCP + targetPort: 22000 + selector: + app: syncthing -- cgit v1.2.3