Skip to content

Add kubernetes events input plugin #1209

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

smallc2009
Copy link
Contributor

@smallc2009 smallc2009 commented Jun 16, 2024

What this PR does / why we need it:

This PR is to support Fluent Bit Kubernetes Event Input Plugin and allow to retrieve these events as logs.
Doc: https://docs.fluentbit.io/manual/pipeline/inputs/kubernetes-events

Which issue(s) this PR fixes:

Fixes #1001

Does this PR introduced a user-facing change?

Fluent Operator supports kubernetes_events input plugin

Additional documentation, usage docs, etc.:

To use kubernetes_events input plugin, list permission is required to retrieve the events from API server. Therefore the ClusterRole has been updated. User need to add rbacRules in FluentBit configuration to grant the Fluent Bit ServiceAccount the ability to list Kubernetes events.

Below is an example configuration.

apiVersion: fluentbit.fluent.io/v1alpha2
kind: FluentBit
metadata:
  name: fluent-bit
  labels:
    app.kubernetes.io/name: fluent-bit
spec:
  rbacRules:
  - apiGroups: [""]
    resources: ["events"]
    verbs: ["list"]
  image: kubesphere/fluent-bit:v2.2.2
  positionDB:
    hostPath:
      path: /var/lib/fluent-bit/  
  fluentBitConfigName: fluentbit-config
---
apiVersion: fluentbit.fluent.io/v1alpha2
kind: ClusterInput
metadata:
  name: kubernetes-events
  labels:
    app.kubernetes.io/name: fluent-bit
spec:
  alias: kubernetes-events
  kubernetesEvents:
    tag: kube_event
    intervalSec: 2
    #kubeURL/kubeCAFile/kubeTokenFile can be ignored, the input will use default value. refer to doc.
    kubeURL: https://kubernetes.default.svc:443
    kubeCAFile: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt
    kubeTokenFile: /var/run/secrets/kubernetes.io/serviceaccount/token

@smallc2009
Copy link
Contributor Author

We can see the Kubernetes Events messages in Standout and ElasticSearch respectively.

Stdout

image

Elasticsearch

image

@smallc2009 smallc2009 marked this pull request as ready for review June 20, 2024 06:02
@benjaminhuo
Copy link
Member

We can see the Kubernetes Events messages in Standout and ElasticSearch respectively.

Great, thanks @smallc2009

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

(feat) FluentBit kubernetes_events input plugin
2 participants