Hi @fbcbarbosa,
Isn't there some configuration that works out of the box for a kubernetes cluster? Maybe one that does not run on hostNetwork? For filebeat I just ran the helm chart and it worked like a charm (no official helm chart is available for metricbeat though).
Host network in metricbeat is recommended to collect also network metrics of the host and this is not needed in filebeat. In principle metricbeat can be run without host network mode if you are not interested on metrics of the host node.
EDIT: I'm not sure hostNetwork would be the way to go though. According to add_kubernetes_metadata,
host
is only required whenin_cluster
is set tofalse
, which is not the case, as I am running metricbeat as part of the cluster. And if I setin_cluster
tofalse
, metricbeat breaks anyway:
Yes, the documentation is not very clear for some of these settings, we have started to do some improvements there (#8036, #8029).
Regarding add_kubernetes_metadata
, it is more intended to be used on events of non-kubernetes metricsets, for example to add the pod metadata to the metrics collected by other modules like nginx. This is a bit tricky when used with the kubernetes
module, the indexers and matchers have to be modified and when it works it can unexpectedly overwrite other metrics under kubernetes
namespace.
In 6.4 all the kubernetes metricsets will also collect labels when possible out of the box, probably the best option in your case is to wait for this release, it is expected to happen on the following days.