From c83119307a82a1f304906b239a761efb4f86c12b Mon Sep 17 00:00:00 2001 From: Jaime Soriano Pastor Date: Thu, 2 Apr 2020 10:54:14 +0200 Subject: [PATCH 1/4] Add data directories to kubernetes manifests Mount data directories in Metricbeat and Auditbeat pods too. They were defined in some places but not mounted. For Auditbeat this is important so it doesn't have to rebuild its file integrity database on each run. For Metricbeat I don't think it is so important, but adding it just in case for consistency with the other reference manifests. --- deploy/kubernetes/auditbeat-kubernetes.yaml | 2 ++ deploy/kubernetes/auditbeat/auditbeat-daemonset.yaml | 2 ++ deploy/kubernetes/metricbeat-kubernetes.yaml | 8 ++++++++ deploy/kubernetes/metricbeat/metricbeat-daemonset.yaml | 2 ++ deploy/kubernetes/metricbeat/metricbeat-deployment.yaml | 6 ++++++ 5 files changed, 20 insertions(+) diff --git a/deploy/kubernetes/auditbeat-kubernetes.yaml b/deploy/kubernetes/auditbeat-kubernetes.yaml index ff4836f6914..e82f68febd4 100644 --- a/deploy/kubernetes/auditbeat-kubernetes.yaml +++ b/deploy/kubernetes/auditbeat-kubernetes.yaml @@ -107,6 +107,8 @@ spec: - name: modules mountPath: /usr/share/auditbeat/modules.d readOnly: true + - name: data + mountPath: /usr/share/auditbeat/data - name: bin mountPath: /hostfs/bin readOnly: true diff --git a/deploy/kubernetes/auditbeat/auditbeat-daemonset.yaml b/deploy/kubernetes/auditbeat/auditbeat-daemonset.yaml index bdd38cd3919..edfc077f068 100644 --- a/deploy/kubernetes/auditbeat/auditbeat-daemonset.yaml +++ b/deploy/kubernetes/auditbeat/auditbeat-daemonset.yaml @@ -54,6 +54,8 @@ spec: - name: modules mountPath: /usr/share/auditbeat/modules.d readOnly: true + - name: data + mountPath: /usr/share/auditbeat/data - name: bin mountPath: /hostfs/bin readOnly: true diff --git a/deploy/kubernetes/metricbeat-kubernetes.yaml b/deploy/kubernetes/metricbeat-kubernetes.yaml index bd8e80eb2d8..154c4c4a0e5 100644 --- a/deploy/kubernetes/metricbeat-kubernetes.yaml +++ b/deploy/kubernetes/metricbeat-kubernetes.yaml @@ -149,6 +149,8 @@ spec: mountPath: /etc/metricbeat.yml readOnly: true subPath: metricbeat.yml + - name: data + mountPath: /usr/share/metricbeat/data - name: modules mountPath: /usr/share/metricbeat/modules.d readOnly: true @@ -294,6 +296,8 @@ spec: - name: modules mountPath: /usr/share/metricbeat/modules.d readOnly: true + - name: data + mountPath: /usr/share/metricbeat/data volumes: - name: config configMap: @@ -303,6 +307,10 @@ spec: configMap: defaultMode: 0600 name: metricbeat-deployment-modules + - name: data + hostPath: + path: /var/lib/metricbeat-data + type: DirectoryOrCreate --- apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRoleBinding diff --git a/deploy/kubernetes/metricbeat/metricbeat-daemonset.yaml b/deploy/kubernetes/metricbeat/metricbeat-daemonset.yaml index 2fe3a7a1b2b..378ac2df1a1 100644 --- a/deploy/kubernetes/metricbeat/metricbeat-daemonset.yaml +++ b/deploy/kubernetes/metricbeat/metricbeat-daemonset.yaml @@ -57,6 +57,8 @@ spec: mountPath: /etc/metricbeat.yml readOnly: true subPath: metricbeat.yml + - name: data + mountPath: /usr/share/metricbeat/data - name: modules mountPath: /usr/share/metricbeat/modules.d readOnly: true diff --git a/deploy/kubernetes/metricbeat/metricbeat-deployment.yaml b/deploy/kubernetes/metricbeat/metricbeat-deployment.yaml index 8b0c5351ed0..cae21a1ea5e 100644 --- a/deploy/kubernetes/metricbeat/metricbeat-deployment.yaml +++ b/deploy/kubernetes/metricbeat/metricbeat-deployment.yaml @@ -58,6 +58,8 @@ spec: - name: modules mountPath: /usr/share/metricbeat/modules.d readOnly: true + - name: data + mountPath: /usr/share/metricbeat/data volumes: - name: config configMap: @@ -67,3 +69,7 @@ spec: configMap: defaultMode: 0600 name: metricbeat-deployment-modules + - name: data + hostPath: + path: /var/lib/metricbeat-data + type: DirectoryOrCreate From 4d6b8ffe53d444d1c5b590f47b52b4a8b6eed36a Mon Sep 17 00:00:00 2001 From: Jaime Soriano Pastor Date: Fri, 3 Apr 2020 13:49:37 +0200 Subject: [PATCH 2/4] Add changelog --- CHANGELOG.next.asciidoc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.next.asciidoc b/CHANGELOG.next.asciidoc index 91798059ffb..6e0422815ed 100644 --- a/CHANGELOG.next.asciidoc +++ b/CHANGELOG.next.asciidoc @@ -178,6 +178,8 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d *Auditbeat* +- Reference kubernetes manifests mount data directory from the host, so data persist between executions in the same node. {pull}17429[17429] + *Filebeat* From 3de9a7e30d08d507cb209491489516aaafe5cf69 Mon Sep 17 00:00:00 2001 From: Jaime Soriano Pastor Date: Fri, 3 Apr 2020 13:50:16 +0200 Subject: [PATCH 3/4] Revert change for metricbeat --- deploy/kubernetes/metricbeat-kubernetes.yaml | 6 ------ deploy/kubernetes/metricbeat/metricbeat-deployment.yaml | 6 ------ 2 files changed, 12 deletions(-) diff --git a/deploy/kubernetes/metricbeat-kubernetes.yaml b/deploy/kubernetes/metricbeat-kubernetes.yaml index 154c4c4a0e5..a3425116b29 100644 --- a/deploy/kubernetes/metricbeat-kubernetes.yaml +++ b/deploy/kubernetes/metricbeat-kubernetes.yaml @@ -296,8 +296,6 @@ spec: - name: modules mountPath: /usr/share/metricbeat/modules.d readOnly: true - - name: data - mountPath: /usr/share/metricbeat/data volumes: - name: config configMap: @@ -307,10 +305,6 @@ spec: configMap: defaultMode: 0600 name: metricbeat-deployment-modules - - name: data - hostPath: - path: /var/lib/metricbeat-data - type: DirectoryOrCreate --- apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRoleBinding diff --git a/deploy/kubernetes/metricbeat/metricbeat-deployment.yaml b/deploy/kubernetes/metricbeat/metricbeat-deployment.yaml index cae21a1ea5e..8b0c5351ed0 100644 --- a/deploy/kubernetes/metricbeat/metricbeat-deployment.yaml +++ b/deploy/kubernetes/metricbeat/metricbeat-deployment.yaml @@ -58,8 +58,6 @@ spec: - name: modules mountPath: /usr/share/metricbeat/modules.d readOnly: true - - name: data - mountPath: /usr/share/metricbeat/data volumes: - name: config configMap: @@ -69,7 +67,3 @@ spec: configMap: defaultMode: 0600 name: metricbeat-deployment-modules - - name: data - hostPath: - path: /var/lib/metricbeat-data - type: DirectoryOrCreate From ff2fc2cb113410b09e460facfe49f2ed9eb2c30f Mon Sep 17 00:00:00 2001 From: Jaime Soriano Pastor Date: Fri, 3 Apr 2020 13:53:22 +0200 Subject: [PATCH 4/4] Add changelog also for metricbeat --- CHANGELOG.next.asciidoc | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.next.asciidoc b/CHANGELOG.next.asciidoc index 6e0422815ed..82dd9297586 100644 --- a/CHANGELOG.next.asciidoc +++ b/CHANGELOG.next.asciidoc @@ -297,6 +297,7 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d - Added documentation for running Metricbeat in Cloud Foundry. {pull}17275[17275] - Add test for documented fields check for metricsets without a http input. {issue}17315[17315] {pull}17334[17334] - Add final tests and move label to GA for the azure module in metricbeat. {pull}17319[17319] +- Reference kubernetes manifests mount data directory from the host when running metricbeat as daemonset, so data persist between executions in the same node. {pull}17429[17429] *Packetbeat*