Fluent Bit is deployed as a DaemonSet (a POD that runs on every node of the cluster). When Fluent Bit runs, it will read, parse and filter the logs of every POD and will enrich log with some more information.
This will enable container (open policy agent) logs available in aws cloudwatch. The log group name where the logs will be /aws/containerinsights/${CLUSTER_NAME}/application ; here CLUSTER_NAME will be "tooling" for prod.
fluentbit.yaml will have
Here’s how the ClusterRole, ClusterRoleBinding, and ConfigMap are linked and their roles in this configuration:
ClusterRole
The ClusterRole named fluent-bit-role defines the permissions that Fluent Bit requires to interact with Kubernetes resources. It specifies:
- 
Non-resource URL access: Allows access to 
/metricswith thegetverb. - 
Resource access: Grants permissions to 
namespaces,pods,pods/logs,nodes, andnodes/proxywith theget,list, andwatchverbs. 
ClusterRoleBinding
The ClusterRoleBinding named fluent-bit-role-binding links the ClusterRole to a subject, enabling Fluent Bit to use the permissions. 
- 
Subject: The 
ServiceAccountnamedfluent-bitin theloggingnamespace. - 
RoleRef: Specifies that the binding refers to the 
fluent-bit-roleClusterRole. 
This linkage ensures that the fluent-bit ServiceAccount has the necessary permissions to collect logs and interact with Kubernetes objects.
ConfigMap
The ConfigMap named fluent-bit-config provides configuration data for Fluent Bit. It contains:
- Fluent Bit configurations: Specifies input sources (e.g., application logs), filtering (e.g., Kubernetes metadata), and output destinations (e.g., CloudWatch Logs).
 - 
Parser definitions: Defines parsers for structured log formats, such as 
dockerandsyslog. 
How They Are Linked
- 
Permissions for Log Access:
- The 
fluent-bitDaemonSet runs pods using thefluent-bitServiceAccount. - The 
fluent-bit-role-bindingbinds thefluent-bit-roleClusterRole to thefluent-bitServiceAccount. - This setup allows Fluent Bit to access logs, Kubernetes metadata, and node information.
 
 - The 
 - 
Configuration Data:
- The DaemonSet mounts the 
fluent-bit-configConfigMap to/fluent-bit/etc/within its pods. - Fluent Bit reads configurations from this directory to process logs according to the defined rules.
 
 - The DaemonSet mounts the 
 
This structure ensures Fluent Bit operates with the correct permissions and configurations in a Kubernetes environment. Let me know if you need further clarification or adjustments!
    
Top comments (0)