From 0be702472635e35178081e3aeae373b650470716 Mon Sep 17 00:00:00 2001 From: Prasanna Kumar Kalever Date: Thu, 12 Aug 2021 18:37:54 +0530 Subject: [PATCH] rbd: provide host-path for rbd-nbd logging Problem: -------- 1. rbd-nbd by default logs to /var/log/ceph/ceph-client.admin.log, Unfortunately, container doesn't have /var/log/ceph directory hence rbd-nbd is not logging now. 2. Rbd-nbd logs are not persistent across nodeplugin restarts. Solution: -------- Provide a host path so that log directory is made available, and the logs persist on the hostnode across container restarts. Signed-off-by: Prasanna Kumar Kalever --- charts/ceph-csi-rbd/templates/nodeplugin-daemonset.yaml | 6 ++++++ charts/ceph-csi-rbd/templates/nodeplugin-psp.yaml | 2 ++ deploy/rbd/kubernetes/csi-nodeplugin-psp.yaml | 2 ++ deploy/rbd/kubernetes/csi-rbdplugin.yaml | 6 ++++++ 4 files changed, 16 insertions(+) diff --git a/charts/ceph-csi-rbd/templates/nodeplugin-daemonset.yaml b/charts/ceph-csi-rbd/templates/nodeplugin-daemonset.yaml index 09cde8939..bcc50a3e5 100644 --- a/charts/ceph-csi-rbd/templates/nodeplugin-daemonset.yaml +++ b/charts/ceph-csi-rbd/templates/nodeplugin-daemonset.yaml @@ -124,6 +124,8 @@ spec: mountPropagation: "Bidirectional" - name: keys-tmp-dir mountPath: /tmp/csi/keys + - name: ceph-logdir + mountPath: /var/log/ceph resources: {{ toYaml .Values.nodeplugin.plugin.resources | indent 12 }} {{- if .Values.nodeplugin.httpMetrics.enabled }} @@ -169,6 +171,10 @@ spec: hostPath: path: {{ .Values.kubeletDir }}/pods type: DirectoryOrCreate + - name: ceph-logdir + hostPath: + path: /var/log/ceph + type: DirectoryOrCreate - name: host-dev hostPath: path: /dev diff --git a/charts/ceph-csi-rbd/templates/nodeplugin-psp.yaml b/charts/ceph-csi-rbd/templates/nodeplugin-psp.yaml index fb9313c11..75665484f 100644 --- a/charts/ceph-csi-rbd/templates/nodeplugin-psp.yaml +++ b/charts/ceph-csi-rbd/templates/nodeplugin-psp.yaml @@ -42,6 +42,8 @@ spec: readOnly: true - pathPrefix: '/lib/modules' readOnly: true + - pathPrefix: '/var/log/ceph' + readOnly: false - pathPrefix: '{{ .Values.kubeletDir }}' readOnly: false {{- end }} diff --git a/deploy/rbd/kubernetes/csi-nodeplugin-psp.yaml b/deploy/rbd/kubernetes/csi-nodeplugin-psp.yaml index 2df3b6cc4..7d735fd86 100644 --- a/deploy/rbd/kubernetes/csi-nodeplugin-psp.yaml +++ b/deploy/rbd/kubernetes/csi-nodeplugin-psp.yaml @@ -38,6 +38,8 @@ spec: readOnly: true - pathPrefix: '/var/lib/kubelet/pods' readOnly: false + - pathPrefix: '/var/log/ceph' + readOnly: false - pathPrefix: '/var/lib/kubelet/plugins/rbd.csi.ceph.com' readOnly: false - pathPrefix: '/var/lib/kubelet/plugins_registry' diff --git a/deploy/rbd/kubernetes/csi-rbdplugin.yaml b/deploy/rbd/kubernetes/csi-rbdplugin.yaml index 9a424a7d6..7b7e7aa3f 100644 --- a/deploy/rbd/kubernetes/csi-rbdplugin.yaml +++ b/deploy/rbd/kubernetes/csi-rbdplugin.yaml @@ -111,6 +111,8 @@ spec: mountPropagation: "Bidirectional" - name: keys-tmp-dir mountPath: /tmp/csi/keys + - name: ceph-logdir + mountPath: /var/log/ceph - name: liveness-prometheus securityContext: privileged: true @@ -146,6 +148,10 @@ spec: hostPath: path: /var/lib/kubelet/pods type: DirectoryOrCreate + - name: ceph-logdir + hostPath: + path: /var/log/ceph + type: DirectoryOrCreate - name: registration-dir hostPath: path: /var/lib/kubelet/plugins_registry/