From 8e7baa1e74693f3fc516f0ca146229c83181030c Mon Sep 17 00:00:00 2001 From: root Date: Tue, 23 Nov 2021 02:10:41 +0100 Subject: [PATCH] =?UTF-8?q?kristof=20j=C3=B3=20gyerek?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- activemq-artemis.yaml | 30 ++++++----------- grafana.yaml | 60 +++++++++++++--------------------- input-influx.yml | 76 +++++++++++++++++++++++++++++++++++++++++++ input-redis.yaml | 38 ++++++++++++++++++++++ model-minio.yml | 28 ++++------------ output-influx.yml | 20 ++---------- rabbitmq-install.sh | 2 +- storage-minio.yaml | 19 ++--------- 8 files changed, 160 insertions(+), 113 deletions(-) create mode 100644 input-influx.yml create mode 100644 input-redis.yaml diff --git a/activemq-artemis.yaml b/activemq-artemis.yaml index 4210aab..e85dd31 100644 --- a/activemq-artemis.yaml +++ b/activemq-artemis.yaml @@ -1,31 +1,15 @@ -apiVersion: v1 -kind: PersistentVolume -metadata: - name: birbnetes-nfs-activemq - namespace: birbnetes -spec: - capacity: - storage: 10Gi - accessModes: - - ReadWriteMany - persistentVolumeReclaimPolicy: Recycle - nfs: - server: 192.168.100.3 - path: /srv/kubedata/birbnetes/activemq ---- kind: PersistentVolumeClaim apiVersion: v1 metadata: name: activemq-pv-claim - labels: - app: activemq namespace: birbnetes spec: accessModes: - - ReadWriteMany + - ReadWriteOnce + storageClassName: longhorn resources: requests: - storage: 10Gi + storage: 1Gi --- apiVersion: apps/v1 kind: Deployment @@ -56,6 +40,13 @@ spec: envFrom: - configMapRef: name: activemq-config + resources: + requests: + memory: "1024Mi" + cpu: "500m" + limits: + memory: "4069Mi" + cpu: "2000m" volumes: - name: activemq-volume persistentVolumeClaim: @@ -98,7 +89,6 @@ spec: - name: activemq-mqtt port: 1883 targetPort: 1883 - nodePort: 30075 protocol: TCP selector: app: activemq diff --git a/grafana.yaml b/grafana.yaml index 55e6c2a..bcbe1cd 100644 --- a/grafana.yaml +++ b/grafana.yaml @@ -1,61 +1,31 @@ -apiVersion: v1 -kind: Service -metadata: - name: grafana - namespace: birbnetes -spec: - type: NodePort - ports: - - name: grafana - port: 3000 - targetPort: 3000 - nodePort: 30070 - protocol: TCP - selector: - app: grafana ---- -apiVersion: v1 -kind: PersistentVolume -metadata: - name: grafana-nfs-pv - namespace: birbnetes -spec: - capacity: - storage: 10Gi - accessModes: - - ReadWriteMany - persistentVolumeReclaimPolicy: Recycle - nfs: - server: 192.168.122.20 - path: /srv/birbdata/grafana --- apiVersion: v1 kind: PersistentVolumeClaim metadata: - name: grafana-nfs-pvc + name: grafana-pvc namespace: birbnetes spec: accessModes: - - ReadWriteMany + - ReadWriteOnce resources: requests: - storage: 10Gi + storage: 5Gi --- apiVersion: v1 kind: ConfigMap metadata: name: grafana - labels: - app: grafana namespace: birbnetes data: - GF_SERVER_ROOT_URL: "https://luna.sch.bme.hu:30070/" + GF_SERVER_ROOT_URL: "https://birbfana.k8s.kmlabz.com/" --- apiVersion: apps/v1 kind: Deployment metadata: name: grafana namespace: birbnetes + labels: + app: grafana spec: selector: matchLabels: @@ -67,10 +37,12 @@ spec: labels: app: grafana spec: + securityContext: + fsGroup: 472 volumes: - name: data persistentVolumeClaim: - claimName: grafana-nfs-pvc + claimName: grafana-pvc containers: - name: grafana volumeMounts: @@ -82,3 +54,17 @@ spec: name: grafana ports: - containerPort: 3000 +--- +apiVersion: v1 +kind: Service +metadata: + name: grafana +spec: + selector: + app: grafana + ports: + - name: grafana + protocol: TCP + port: 80 + targetPort: 3000 + diff --git a/input-influx.yml b/input-influx.yml new file mode 100644 index 0000000..c735f7b --- /dev/null +++ b/input-influx.yml @@ -0,0 +1,76 @@ +apiVersion: v1 +kind: Service +metadata: + name: input-influx + namespace: birbnetes +spec: + type: ClusterIP + ports: + - port: 8086 + targetPort: 8086 + protocol: TCP + selector: + app: input-influx +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: input-influxdb + namespace: birbnetes +spec: + selector: + matchLabels: + app: input-influx + strategy: + type: Recreate + replicas: 1 + template: + metadata: + labels: + app: input-influx + spec: + containers: + - name: input-influx + image: influxdb + imagePullPolicy: "IfNotPresent" + ports: + - containerPort: 8086 + envFrom: + - configMapRef: + name: input-influx-config + volumeMounts: + - mountPath: /var/lib/influxdb + name: input-influx-storage + volumes: + - name: input-influx-storage + persistentVolumeClaim: + claimName: input-influx-storage-pv-claim +--- +kind: PersistentVolumeClaim +apiVersion: v1 +metadata: + name: input-influx-storage-pv-claim + labels: + app: input-influx + namespace: birbnetes +spec: + storageClassName: longhorn + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 2Gi +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: input-influx-config + labels: + app: input-influx + namespace: birbnetes +data: + INFLUXDB_DB: input-service + INFLUXDB_USER: output-service + INFLUXDB_USER_PASSWORD: input-service-supersecret + INFLUXDB_READ_USER: grafana + INFLUXDB_READ_USER_PASSWORD: CorrectHorseBatteryStaple diff --git a/input-redis.yaml b/input-redis.yaml new file mode 100644 index 0000000..69db143 --- /dev/null +++ b/input-redis.yaml @@ -0,0 +1,38 @@ +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: input-redis + namespace: birbnetes + labels: + app: input-redis +spec: + selector: + matchLabels: + app: input-redis + strategy: + type: Recreate + template: + metadata: + labels: + app: input-redis + spec: + containers: + - name: input-redis + image: redis + ports: + - containerPort: 6379 +--- +apiVersion: v1 +kind: Service +metadata: + name: input-redis +spec: + selector: + app: input-redis + ports: + - name: input-redis + protocol: TCP + port: 6379 + targetPort: 6379 + diff --git a/model-minio.yml b/model-minio.yml index 6650f20..8cffbbd 100644 --- a/model-minio.yml +++ b/model-minio.yml @@ -1,19 +1,4 @@ apiVersion: v1 -kind: PersistentVolume -metadata: - name: birbnetes-nfs-model-minio - namespace: birbnetes -spec: - capacity: - storage: 10Gi - accessModes: - - ReadWriteMany - persistentVolumeReclaimPolicy: Recycle - nfs: - server: 192.168.100.3 - path: /srv/kubedata/birbnetes/model_minio ---- -apiVersion: v1 kind: Service metadata: name: model-minio @@ -30,14 +15,15 @@ spec: apiVersion: v1 kind: PersistentVolumeClaim metadata: - name: birbnetes-nfs-model-minio + name: pvc-minio-model namespace: birbnetes spec: + storageClassName: longhorn accessModes: - - ReadWriteMany + - ReadWriteOnce resources: requests: - storage: 10Gi + storage: 3Gi --- apiVersion: v1 kind: ConfigMap @@ -69,13 +55,13 @@ spec: volumes: - name: data persistentVolumeClaim: - claimName: birbnetes-nfs-model-minio + claimName: pvc-minio-model containers: - name: model-minio volumeMounts: - - name: data + - name: data mountPath: "/data" - image: minio/minio:RELEASE.2020-03-25T07-03-04Z + image: minio/minio:latest args: - server - /data diff --git a/output-influx.yml b/output-influx.yml index 8ae1480..22a9c0d 100644 --- a/output-influx.yml +++ b/output-influx.yml @@ -46,21 +46,6 @@ spec: persistentVolumeClaim: claimName: output-influx-storage-pv-claim --- -apiVersion: v1 -kind: PersistentVolume -metadata: - name: birbnetes-nfs-output-influx - namespace: birbnetes -spec: - capacity: - storage: 10Gi - accessModes: - - ReadWriteMany - persistentVolumeReclaimPolicy: Recycle - nfs: - server: 192.168.100.3 - path: /srv/kubedata/birbnetes/outflux ---- kind: PersistentVolumeClaim apiVersion: v1 metadata: @@ -69,11 +54,12 @@ metadata: app: output-influx namespace: birbnetes spec: + storageClassName: longhorn accessModes: - - ReadWriteMany + - ReadWriteOnce resources: requests: - storage: 10Gi + storage: 2Gi --- apiVersion: v1 kind: ConfigMap diff --git a/rabbitmq-install.sh b/rabbitmq-install.sh index a74caa6..b0899a8 100644 --- a/rabbitmq-install.sh +++ b/rabbitmq-install.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash helm repo add bitnami https://charts.bitnami.com/bitnami -helm install --set persistence.size=10Gi birb-rabbitmq bitnami/rabbitmq --namespace birbnetes +helm install --set persistence.size=2Gi birb-rabbitmq bitnami/rabbitmq --namespace birbnetes echo "Password : $(kubectl get secret --namespace birbnetes birb-rabbitmq -o jsonpath="{.data.rabbitmq-password}" | base64 --decode)" diff --git a/storage-minio.yaml b/storage-minio.yaml index 02b6d8f..8db9ee5 100644 --- a/storage-minio.yaml +++ b/storage-minio.yaml @@ -1,19 +1,4 @@ apiVersion: v1 -kind: PersistentVolume -metadata: - name: birbnetes-nfs-storage-minio - namespace: birbnetes -spec: - capacity: - storage: 10Gi - accessModes: - - ReadWriteOnce - persistentVolumeReclaimPolicy: Recycle - nfs: - server: 192.168.100.3 - path: /srv/kubedata/birbnetes/storage_minio ---- -apiVersion: v1 kind: Service metadata: name: minio-service @@ -73,9 +58,9 @@ spec: containers: - name: minio volumeMounts: - - name: data + - name: data mountPath: "/data" - image: minio/minio:RELEASE.2020-03-25T07-03-04Z + image: minio/minio:latest args: - server - /data