prometheus

This commit is contained in:
Sebastian Schüler 2025-12-09 17:05:51 +01:00
parent f3b4b755cf
commit 41ed539571
7 changed files with 194 additions and 0 deletions

View File

@ -0,0 +1,59 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: jellyfin
spec:
replicas: 1
selector:
matchLabels:
app: jellyfin
template:
metadata:
labels:
app: jellyfin
spec:
containers:
- name: jellyfin
image: jellyfin/jellyfin:latest
ports:
- containerPort: 8096 # HTTP
- containerPort: 8920 # HTTPS (if enabled)
volumeMounts:
- name: jellyfin-config
mountPath: /config
- name: jellyfin-cache
mountPath: /cache
- name: jellyfin-media
mountPath: /media # adjust to your real media structure
resources:
requests:
memory: "512Mi"
cpu: "200m"
limits:
memory: "2Gi"
cpu: "1000m"
volumes:
- name: jellyfin-config
persistentVolumeClaim:
claimName: jellyfin-config-pvc
- name: jellyfin-cache
persistentVolumeClaim:
claimName: jellyfin-cache-pvc
- name: jellyfin-media
hostPath:
path: /var/lib/rancher/k3s/storage/jellyfin-data-mnt # where data is on host FS
type: Directory
---
apiVersion: v1
kind: Service
metadata:
name: jellyfin
spec:
type: NodePort
selector:
app: jellyfin
ports:
- name: http
port: 8096
targetPort: 8096
nodePort: 30096

21
apps/jellyfin/pvc.yaml Normal file
View File

@ -0,0 +1,21 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: jellyfin-config-pvc
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 5Gi
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: jellyfin-cache-pvc
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 10Gi

View File

@ -12,3 +12,10 @@ data:
static_configs:
- targets:
- localhost:9090
- job_name: "node-exporter"
kubernetes_sd_configs:
- role: endpoints
relabel_configs:
- source_labels: [__meta_kubernetes_endpoints_name]
regex: node-exporter
action: keep

View File

@ -12,6 +12,7 @@ spec:
labels:
app: prometheus
spec:
serviceAccountName: prometheus
nodeSelector:
kubernetes.io/hostname: raspberrypi
containers:
@ -57,3 +58,9 @@ spec:
port: 9090
targetPort: 9090
nodePort: 30390
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: prometheus
namespace: default

28
apps/prometheus/rbac.yaml Normal file
View File

@ -0,0 +1,28 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: prometheus
rules:
- apiGroups: [""]
resources:
- nodes
- nodes/metrics
- pods
- services
- endpoints
verbs: ["get", "list", "watch"]
- nonResourceURLs: ["/metrics"]
verbs: ["get"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: prometheus
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: prometheus
subjects:
- kind: ServiceAccount
name: prometheus
namespace: default

View File

@ -0,0 +1,15 @@
apiVersion: v1
kind: Service
metadata:
name: node-exporter
labels:
app: node-exporter
spec:
selector:
app: node-exporter
ports:
- name: metrics
port: 9100
targetPort: 9100
protocol: TCP
clusterIP: None # optional, but good for headless discovery

View File

@ -0,0 +1,57 @@
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: node-exporter
namespace: default
labels:
app: node-exporter
spec:
selector:
matchLabels:
app: node-exporter
template:
metadata:
annotations:
cluster-autoscaler.kubernetes.io/safe-to-evict: "true"
labels:
app: node-exporter
spec:
hostNetwork: true
hostPID: true
containers:
- name: node-exporter
image: prom/node-exporter:v1.8.1
args:
- --web.listen-address=0.0.0.0:9100
- --path.procfs=/host/proc
- --path.sysfs=/host/sys
ports:
- name: metrics
containerPort: 9100
hostPort: 9100
volumeMounts:
- name: proc
mountPath: /host/proc
readOnly: true
- name: sys
mountPath: /host/sys
readOnly: true
resources:
requests:
cpu: 50m
memory: 64Mi
limits:
cpu: 200m
memory: 128Mi
tolerations:
- effect: NoSchedule
operator: Exists
- effect: NoExecute
operator: Exists
volumes:
- name: proc
hostPath:
path: /proc
- name: sys
hostPath:
path: /sys