add-kubernetes

This commit is contained in:
James Turland
2024-07-08 11:19:54 +01:00
parent 0cd8339e6e
commit ef6ba4bd22
42 changed files with 1375 additions and 0 deletions

View File

@@ -0,0 +1,16 @@
apiVersion: traefik.io/v1alpha1
kind: Middleware
metadata:
name: default-headers
namespace: jellyfin
spec:
headers:
browserXssFilter: true
contentTypeNosniff: true
forceSTSHeader: true
stsIncludeSubdomains: true
stsPreload: true
stsSeconds: 15552000
customFrameOptionsValue: SAMEORIGIN
customRequestHeaders:
X-Forwarded-Proto: https

View File

@@ -0,0 +1,26 @@
---
apiVersion: traefik.io/v1alpha1
kind: IngressRoute
metadata:
name: jellyfin
namespace: jellyfin
annotations:
kubernetes.io/ingress.class: traefik-external
spec:
entryPoints:
- websecure
routes:
- match: Host(`www.jellyfin.yourdomain.co.uk`)
kind: Rule
services:
- name: jellyfin
port: 8096
- match: Host(`jellyfin.yourdomain.co.uk`)
kind: Rule
services:
- name: jellyfin
port: 8096
middlewares:
- name: default-headers
tls:
secretName: yourdomain-tls

View File

@@ -0,0 +1,85 @@
---
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: jellyfin
app.kubernetes.io/instance: jellyfin
app.kubernetes.io/name: jellyfin
name: jellyfin
namespace: jellyfin
spec:
replicas: 1
selector:
matchLabels:
app: jellyfin
template:
metadata:
labels:
app: jellyfin
app.kubernetes.io/name: jellyfin
spec:
nodeSelector:
# gpu: "true"
worker: "true"
containers:
- image: jellyfin/jellyfin
imagePullPolicy: Always
name: jellyfin
ports:
- containerPort: 8096
name: web
protocol: TCP
env:
- name: TZ
value: Europe/London
volumeMounts:
- mountPath: /config
name: jellyfin
subPath: config
- mountPath: /cache
name: jellyfin
subPath: cache
- mountPath: "/Audiobooks"
readOnly: false
name: smb
subPath: Audiobooks
- mountPath: "/Films"
readOnly: false
name: smb
subPath: Films
- mountPath: "/TVShows"
readOnly: false
name: smb
subPath: TVShows
- mountPath: "/Music"
readOnly: false
name: smb
subPath: Music
volumes:
- name: jellyfin
persistentVolumeClaim:
claimName: jellyfin
- name: smb
persistentVolumeClaim:
claimName: pvc-jellyfin-smb
---
apiVersion: v1
kind: Service
metadata:
labels:
app: jellyfin
name: jellyfin
namespace: jellyfin
spec:
ports:
- name: web-tcp
port: 8096
protocol: TCP
targetPort: 8096
- name: web-udp
port: 8096
protocol: UDP
targetPort: 8096
selector:
app: jellyfin

View File

@@ -0,0 +1,24 @@
kind: NetworkPolicy
apiVersion: networking.k8s.io/v1
metadata:
name: allow-internet-only
namespace: jellyfin
spec:
podSelector: {}
policyTypes:
- Egress
egress:
- to:
- ipBlock:
cidr: "0.0.0.0/0"
except:
- "10.0.0.0/8"
- "172.16.0.0/12"
- "192.168.0.0/16"
- to:
- namespaceSelector:
matchLabels:
kubernetes.io/metadata.name: "kube-system"
- podSelector:
matchLabels:
k8s-app: "kube-dns"

View File

@@ -0,0 +1,27 @@
apiVersion: v1
kind: PersistentVolume
metadata:
annotations:
pv.kubernetes.io/provisioned-by: smb.csi.k8s.io
name: pv-jellyfin-smb
spec:
capacity:
storage: 100Gi
accessModes:
- ReadWriteMany
persistentVolumeReclaimPolicy: Retain
storageClassName: smb
mountOptions:
- dir_mode=0777
- file_mode=0777
csi:
driver: smb.csi.k8s.io
readOnly: false
# volumeHandle format: {smb-server-address}#{sub-dir-name}#{share-name}
# make sure this value is unique for every share in the cluster
volumeHandle: jellyfin
volumeAttributes:
source: "//192.168.x.x/your-nas"
nodeStageSecretRef:
name: smbcreds
namespace: default

View File

@@ -0,0 +1,14 @@
---
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: pvc-jellyfin-smb
namespace: jellyfin
spec:
accessModes:
- ReadWriteMany
resources:
requests:
storage: 10Gi
volumeName: pv-jellyfin-smb
storageClassName: smb