fluent-bit icon indicating copy to clipboard operation
fluent-bit copied to clipboard

Inherit fluentbit kubernetes annotations from namespace

Open bilbof opened this issue 3 years ago • 4 comments

Is your feature request related to a problem? Please describe.

This relates to the Kubernetes filter. Currently users must set the annotation fluentbit.io/exclude: 'true' on pods to drop logs from their containers. To drop logs from all pods in a namespace, users need to set the annotation on all pods in the namespace.

Describe the solution you'd like

A common pattern is to set namespace-level annotations which then set default logic for pods in the namespace.

I'd like to set the fluentbit annotations at the namespace level. Applying a fluentbit annotation to a namespace would mean the pod inherits the fluentbit annotation (e.g. all logs would be dropped from the namespace).

Describe alternatives you've considered

One can use an Input filter exclude_path, but this is a bit clunky, since it creates a long list like exclude_path /var/log/containers/*_<namespace_1>*.log,/var/log/containers/*_<namespace_2>*.log,/var/log/containers/*_<namespace_3>*.log,... and involves rolling a config change to fluentbit pods.

Additional context

Semi-related to https://github.com/fluent/fluent-bit/issues/6544

bilbof avatar Feb 10 '23 11:02 bilbof

This would be a great feature. As a workaround we have created a Kyverno ClusterPolicy that mutates every Pod and patches it with the annotation from the namespace. The namespace-level annotation is referenced as an external data variable via a K8s API call and then injected on each Pod in that namespace.

felfa01 avatar May 25 '23 12:05 felfa01

This issue is stale because it has been open 90 days with no activity. Remove stale label or comment or this will be closed in 5 days. Maintainers can add the exempt-stale label.

github-actions[bot] avatar Aug 24 '23 01:08 github-actions[bot]

This issue was closed because it has been stalled for 5 days with no activity.

github-actions[bot] avatar Aug 29 '23 01:08 github-actions[bot]

sad

genofire avatar Oct 10 '23 18:10 genofire