问题
Is there a way to exclude certain namespaces in fluet-bit? I would like to exclude certain namespaces so that fluent bit doesn't forward all logs created in those namespaces to ELK.
Is there a way to do it besides adding annotation to each pod in that namespace? Im aware that you can update all of the pods annotations in a namespace via kubectl.
kubectl annotate pods --namespace=pks-system --all fluentbit.io/exclude='true'
回答1:
According to official Fluent Bit
documentation, for the moment it is actually the unique way of requesting that the log processor skips the logs from certain Pods. I searched through it and found nothing but this fragment.
In addition to that, there is even a feature request raised on their GitHub project so for now we can hope it will be available in a future release.
In documentation there is only example of a separate Pod definition
but for sure you should be able to apply it to Pod template
in Deployment
definition so you don't have to apply it to each Pod separately or to every Pod in certain namespace using the kubectl command you provided.
回答2:
You must read this: https://docs.fluentbit.io/manual/filter/kubernetes#kubernetes-annotations At documentation: "Request to Fluent Bit to exclude or not the logs generated by the Pod. This option will only be processed if Fluent Bit configuration (Kubernetes Filter) have enabled the option K8S-Logging.Exclude."
来源:https://stackoverflow.com/questions/57027935/how-to-exclude-namespace-from-fluent-bit-logging