From 6fe3a5da1607916752397f391356135e097db6c0 Mon Sep 17 00:00:00 2001 From: Kai Moritz Date: Tue, 3 Oct 2023 15:39:20 +0200 Subject: [PATCH] Strimzi - Local Storage: Defined static PVs See: * https://kubernetes.io/blog/2019/04/04/kubernetes-1.14-local-persistent-volumes-ga/ * https://docs.confluent.io/operator/current/co-storage.html#use-statically-provisioned-persistent-volumes sudo mkdir /var/lib/local-storage sudo mkdir /var/lib/local-storage/zookeeper-0 sudo mkdir /var/lib/local-storage/kafka-0 kubectl -n juplo apply -f local-storage.yaml kubectl apply -f pv-zookeeper-0.yaml kubectl apply -f pv-kafka-0.yaml kubectl get pv kubectl -n juplo apply -f cluster.yaml kubectl -n juplo get pvc kubectl -n juplo get pvc/data-0-juplo-kafka-0 -o yaml --- strimzi-kafka/cluster.yaml | 2 ++ strimzi-kafka/local-storage.yaml | 6 ++++++ strimzi-kafka/pv-kafka-0.yaml | 22 ++++++++++++++++++++++ strimzi-kafka/pv-zookeeper-0.yaml | 22 ++++++++++++++++++++++ 4 files changed, 52 insertions(+) create mode 100644 strimzi-kafka/local-storage.yaml create mode 100644 strimzi-kafka/pv-kafka-0.yaml create mode 100644 strimzi-kafka/pv-zookeeper-0.yaml diff --git a/strimzi-kafka/cluster.yaml b/strimzi-kafka/cluster.yaml index 3d9f95b..2ed0da3 100644 --- a/strimzi-kafka/cluster.yaml +++ b/strimzi-kafka/cluster.yaml @@ -27,6 +27,7 @@ spec: volumes: - id: 0 type: persistent-claim + class: local-storage size: 1Gi deleteClaim: false zookeeper: @@ -34,6 +35,7 @@ spec: storage: storage: type: persistent-claim + class: local-storage size: 500Mi deleteClaim: false entityOperator: diff --git a/strimzi-kafka/local-storage.yaml b/strimzi-kafka/local-storage.yaml new file mode 100644 index 0000000..e6ce6fb --- /dev/null +++ b/strimzi-kafka/local-storage.yaml @@ -0,0 +1,6 @@ +apiVersion: storage.k8s.io/v1 +kind: StorageClass +metadata: + name: local-storage +provisioner: kubernetes.io/no-provisioner +volumeBindingMode: WaitForFirstConsumer diff --git a/strimzi-kafka/pv-kafka-0.yaml b/strimzi-kafka/pv-kafka-0.yaml new file mode 100644 index 0000000..da92b7c --- /dev/null +++ b/strimzi-kafka/pv-kafka-0.yaml @@ -0,0 +1,22 @@ +apiVersion: v1 +kind: PersistentVolume +metadata: + name: pv-kafka-0 +spec: + capacity: + storage: 1Gi + volumeMode: Filesystem + accessModes: + - ReadWriteOnce + persistentVolumeReclaimPolicy: Retain + storageClassName: local-storage + local: + path: /var/lib/local-storage/kafka-0 + nodeAffinity: + required: + nodeSelectorTerms: + - matchExpressions: + - key: kubernetes.io/hostname + operator: In + values: + - ryzen diff --git a/strimzi-kafka/pv-zookeeper-0.yaml b/strimzi-kafka/pv-zookeeper-0.yaml new file mode 100644 index 0000000..dd571a7 --- /dev/null +++ b/strimzi-kafka/pv-zookeeper-0.yaml @@ -0,0 +1,22 @@ +apiVersion: v1 +kind: PersistentVolume +metadata: + name: pv-zookeeper-0 +spec: + capacity: + storage: 500Mi + volumeMode: Filesystem + accessModes: + - ReadWriteOnce + persistentVolumeReclaimPolicy: Retain + storageClassName: local-storage + local: + path: /var/lib/local-storage/zookeeper-0 + nodeAffinity: + required: + nodeSelectorTerms: + - matchExpressions: + - key: kubernetes.io/hostname + operator: In + values: + - ryzen -- 2.20.1