From 332895c58ac60cb6790edca512586f7f5f63415c Mon Sep 17 00:00:00 2001 From: David Date: Mon, 28 Nov 2022 14:25:03 +0100 Subject: [PATCH] =?UTF-8?q?bearbeitet=20das=20server=20und=20postgres=20De?= =?UTF-8?q?ployment=20mit=20der=20hinzugef=C3=BCgten=20Environment-Variabl?= =?UTF-8?q?e=20Reference=20aus=20dem=20Secret=20Objekt.=20Hinzugef=C3=BCgt?= =?UTF-8?q?=20die=20Datei=20mit=20dem=20imperativen=20Befehl,=20wobei=20wi?= =?UTF-8?q?rd=20ein=20Secret=20Objekt=20ins=20Kluster=20erstellt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../multi-client-app/creating-secret-imperative.txt | 8 ++++++++ Kubernetes/multi-client-app/postgres-deployment.yaml | 6 ++++++ Kubernetes/multi-client-app/server-deployment.yaml | 9 +++++++-- Kubernetes/multi-client-app/worker-deployment.yaml | 2 +- 4 files changed, 22 insertions(+), 3 deletions(-) create mode 100644 Kubernetes/multi-client-app/creating-secret-imperative.txt diff --git a/Kubernetes/multi-client-app/creating-secret-imperative.txt b/Kubernetes/multi-client-app/creating-secret-imperative.txt new file mode 100644 index 0000000..a18a698 --- /dev/null +++ b/Kubernetes/multi-client-app/creating-secret-imperative.txt @@ -0,0 +1,8 @@ +kubectl create secret generic --from-literal key=value + +create - Imperative command to create a new object +secret - Type of object we are going to create +generic - Type of secret + - Name of secret for later reference in a pod config +--from-literal - We are going to add the secret information into this command(as opposed to from . file)) +key=value - Key-value par of the secret information \ No newline at end of file diff --git a/Kubernetes/multi-client-app/postgres-deployment.yaml b/Kubernetes/multi-client-app/postgres-deployment.yaml index f885b69..5bd4add 100644 --- a/Kubernetes/multi-client-app/postgres-deployment.yaml +++ b/Kubernetes/multi-client-app/postgres-deployment.yaml @@ -25,3 +25,9 @@ spec: - name: postgres-storage mountPath: /var/lib/postgresql/data subPath: postgres + env: + - name: PGPASSWORD + valueFrom: + secretKeyRef: + name: pgpassword # Kubernetes wird nach dem Objekt Secret "pgpassword" suchen "k create secret generic pgpassword --from-literal PGPASSWORD=password123" + key: PGPASSWORD # In unserem Fall das Objekt Secret mit dem Namen "pgpassword" beinhaltet den Schlüssel PGPASSWORD mit dem Wert password123 diff --git a/Kubernetes/multi-client-app/server-deployment.yaml b/Kubernetes/multi-client-app/server-deployment.yaml index cf26cf1..427e02d 100644 --- a/Kubernetes/multi-client-app/server-deployment.yaml +++ b/Kubernetes/multi-client-app/server-deployment.yaml @@ -21,12 +21,17 @@ spec: - name: REDIS_HOST value: redis-cluster-ip-service - name: REDIS_PORT - value: 6379 + value: "6379" - name: PGUSER value: postgres - name: PGHOST value: postgres-cluster-ip-service - name: PGPORT - value: 5432 + value: "5432" - name: PGDATABASE value: postgres + - name: PGPASSWORD + valueFrom: + secretKeyRef: + name: pgpassword # Kubernetes wird nach dem Objekt Secret "pgpassword" suchen "k create secret generic pgpassword --from-literal PGPASSWORD=password123" + key: PGPASSWORD # In unserem Fall das Objekt Secret beinhaltet den Schlüssel PGPASSWORD mit dem Wert password123 diff --git a/Kubernetes/multi-client-app/worker-deployment.yaml b/Kubernetes/multi-client-app/worker-deployment.yaml index ed41910..627be9d 100644 --- a/Kubernetes/multi-client-app/worker-deployment.yaml +++ b/Kubernetes/multi-client-app/worker-deployment.yaml @@ -19,4 +19,4 @@ spec: - name: REDIS_HOST value: redis-cluster-ip-service - name: REDIS_PORT - value: 6379 + value: "6379"