From 0e4ddcefdfee276c8e3d44266339c8b8bb621f41 Mon Sep 17 00:00:00 2001 From: baschno Date: Mon, 21 Apr 2025 21:18:23 +0200 Subject: [PATCH] longhorn nummer 2 --- Traefik/traefik-values.yaml | 9 -------- longhorn/README.md | 19 ++++++++++++---- longhorn/longhorn-ingressroute.yaml | 14 +++++------- longhorn/longhorn-values.yaml | 34 +++++++++++++++++++++++++++++ longhorn/test/pod-uses-pvc.yaml | 28 ++++++++++++++++++++++++ longhorn/test/pvc.yaml | 13 +++++++++++ 6 files changed, 96 insertions(+), 21 deletions(-) create mode 100644 longhorn/test/pod-uses-pvc.yaml create mode 100644 longhorn/test/pvc.yaml diff --git a/Traefik/traefik-values.yaml b/Traefik/traefik-values.yaml index 4937a37..cec8334 100644 --- a/Traefik/traefik-values.yaml +++ b/Traefik/traefik-values.yaml @@ -1,6 +1,5 @@ ports: web: -<<<<<<< HEAD redirections: entryPoint: to: websecure @@ -8,14 +7,6 @@ ports: logs: general: level: DEBUG -======= - redirections: - entryPoint: - to: websecure - scheme: https - permanent: true - ->>>>>>> 1b0f340 (neu ist der mai) ingressRoute: dashboard: enabled: true diff --git a/longhorn/README.md b/longhorn/README.md index 242d495..87856e0 100644 --- a/longhorn/README.md +++ b/longhorn/README.md @@ -5,15 +5,26 @@ Hier sind die Schritte, um ein Persistent Volume für Longhorn zu erstellen: ### 1. Stelle sicher, dass Longhorn installiert ist Zuerst solltest du sicherstellen, dass Longhorn auf deinem Cluster installiert ist. Falls Longhorn noch nicht installiert ist, kannst du es mit Helm oder direkt aus den YAML-Dateien installieren. + +#### Node Labeling + +In the case not all nodes should provide disk +``` +k label nodes k3s-prod-worker-{1..3} node.longhorn.io/create-default-disk=true +``` + + + #### Mit Helm: ```bash helm repo add longhorn https://charts.longhorn.io -helm install longhorn longhorn/longhorn --namespace longhorn-system --create-namespace +helm install longhorn longhorn/longhorn --namespace longhorn-system --create-namespace --values longhorn-values.yaml ``` -#### Mit kubectl: -```bash -kubectl apply -f https://raw.githubusercontent.com/longhorn/longhorn/v1.2.2/deploy/install.yaml + +### Check via UI +``` +k port-forward svc/longhorn-frontend 8000:80 -n longhorn-system ``` ### 2. Erstelle ein PersistentVolume (PV) und ein PersistentVolumeClaim (PVC) diff --git a/longhorn/longhorn-ingressroute.yaml b/longhorn/longhorn-ingressroute.yaml index 8a48388..20258de 100644 --- a/longhorn/longhorn-ingressroute.yaml +++ b/longhorn/longhorn-ingressroute.yaml @@ -1,18 +1,16 @@ ---- apiVersion: traefik.io/v1alpha1 kind: IngressRoute metadata: - name: longhorn-web-ui + name: longhorn-ingress-route namespace: longhorn-system spec: - properties: - entrypoints: - - websecure + entryPoints: + - websecure routes: - - match: Host(`longhorn.k8s.internal.schnrbs.work`) + - match: Host(`longhorn-dashboard.k8s.schnrbs.work`) kind: Rule services: - name: longhorn-frontend port: 80 - tls: - secretName: longhorn-web-ui-tls + tls: + secretName: longhorn-web-ui-tls \ No newline at end of file diff --git a/longhorn/longhorn-values.yaml b/longhorn/longhorn-values.yaml index 6f33b19..06b007a 100644 --- a/longhorn/longhorn-values.yaml +++ b/longhorn/longhorn-values.yaml @@ -1,2 +1,36 @@ +global: + nodeSelector: + node.longhorn.io/create-default-disk: "true" + +service: + ui: + type: NodePort + nodePort: 30050 + manager: + type: ClusterIP + +# Replica count for the default Longhorn StorageClass. +persistence: + defaultClass: false + defaultFsType: ext4 + defaultClassReplicaCount: 2 + reclaimPolicy: Delete + +# Replica counts for CSI Attacher, Provisioner, Resizer, Snapshotter +csi: + attacherReplicaCount: 2 + provisionerReplicaCount: 2 + resizerReplicaCount: 2 + snapshotterReplicaCount: 2 + +# Default replica count and storage path +defaultSettings: + upgradeChecker: false + kubernetesClusterAutoscalerEnabled: false + allowCollectingLonghornUsageMetrics: false + createDefaultDiskLabeledNodes: true + defaultReplicaCount: 2 + defaultDataPath: "/k8s-data" + longhornUI: replicas: 1 diff --git a/longhorn/test/pod-uses-pvc.yaml b/longhorn/test/pod-uses-pvc.yaml new file mode 100644 index 0000000..c9fdc9f --- /dev/null +++ b/longhorn/test/pod-uses-pvc.yaml @@ -0,0 +1,28 @@ +apiVersion: v1 +kind: Pod +metadata: + name: longhorn-pod + namespace: default +spec: + nodeName: k8s-worker3 + restartPolicy: Always + containers: + - name: nginx + image: nginx:stable-alpine + imagePullPolicy: IfNotPresent + livenessProbe: + exec: + command: + - ls + - /data/lost+found + initialDelaySeconds: 5 + periodSeconds: 5 + volumeMounts: + - name: volv + mountPath: /data + ports: + - containerPort: 80 + volumes: + - name: volv + persistentVolumeClaim: + claimName: longhorn-pvc \ No newline at end of file diff --git a/longhorn/test/pvc.yaml b/longhorn/test/pvc.yaml new file mode 100644 index 0000000..b940071 --- /dev/null +++ b/longhorn/test/pvc.yaml @@ -0,0 +1,13 @@ +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: longhorn-pvc + namespace: default +spec: + accessModes: + - ReadWriteOnce + storageClassName: longhorn + resources: + requests: + storage: 2Gi