From 3ad1d147d8d4c1a8b7c5e34985745354d4565943 Mon Sep 17 00:00:00 2001 From: Murat Ugur Eminoglu Date: Thu, 19 Dec 2024 13:18:03 +0300 Subject: [PATCH] Add hostPath volume to save pod logs --- kubernetes/ams-k8s-deployment-edge.yaml | 13 +++++++++++++ kubernetes/ams-k8s-deployment-origin.yaml | 14 +++++++++++++- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/kubernetes/ams-k8s-deployment-edge.yaml b/kubernetes/ams-k8s-deployment-edge.yaml index 71b3d938..9a25b1ee 100644 --- a/kubernetes/ams-k8s-deployment-edge.yaml +++ b/kubernetes/ams-k8s-deployment-edge.yaml @@ -45,9 +45,18 @@ spec: # You may also need to add -u and -p parameters for # specifying mongodb username and passwords respectively args: ["-g", "true", "-s", "true", "-r", "true", "-m", "cluster", "-h", "mongo"] + env: + - name: POD_NAME + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: metadata.name volumeMounts: - mountPath: /tmp name: temp-volume + - mountPath: /var/log/antmedia/ + name: log-storage + subPath: ${POD_NAME} livenessProbe: httpGet: path: / @@ -68,6 +77,10 @@ spec: path: /temp-data type: DirectoryOrCreate name: temp-volume + - hostPath: + path: /mnt/logs/antmedia + type: DirectoryOrCreate + name: log-storage # imagePullSecrets: # - name: docker diff --git a/kubernetes/ams-k8s-deployment-origin.yaml b/kubernetes/ams-k8s-deployment-origin.yaml index ec0982c9..b99e0a44 100644 --- a/kubernetes/ams-k8s-deployment-origin.yaml +++ b/kubernetes/ams-k8s-deployment-origin.yaml @@ -45,9 +45,18 @@ spec: # You may also need to add -u and -p parameters for # specifying mongodb username and passwords respectively args: ["-g", "true", "-s", "true", "-r", "true", "-m", "cluster", "-h", "mongo"] + env: + - name: POD_NAME + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: metadata.name volumeMounts: - mountPath: /tmp name: temp-volume + - mountPath: /var/log/antmedia/ + name: log-storage + subPath: ${POD_NAME} livenessProbe: httpGet: path: / @@ -68,6 +77,9 @@ spec: path: /temp-data type: DirectoryOrCreate name: temp-volume - + - hostPath: + path: /mnt/logs/antmedia + type: DirectoryOrCreate + name: log-storage # imagePullSecrets: # - name: docker