{"id":13491346,"url":"https://github.com/kubesphere/kube-events","last_synced_at":"2025-05-15T04:06:49.782Z","repository":{"id":39634995,"uuid":"250487520","full_name":"kubesphere/kube-events","owner":"kubesphere","description":"K8s Event Exporting, Filtering and Alerting in Multi-Tenant Environment","archived":false,"fork":false,"pushed_at":"2025-01-22T03:31:01.000Z","size":718,"stargazers_count":198,"open_issues_count":18,"forks_count":34,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-05-12T01:27:51.761Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kubesphere.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2020-03-27T09:04:19.000Z","updated_at":"2025-04-17T05:58:40.000Z","dependencies_parsed_at":"2024-03-04T20:30:44.705Z","dependency_job_id":"e7cc5f30-1553-4d2a-addc-f853708794a2","html_url":"https://github.com/kubesphere/kube-events","commit_stats":{"total_commits":84,"total_committers":14,"mean_commits":6.0,"dds":0.5595238095238095,"last_synced_commit":"91e09c2b2499d11b3cf6e9503e5a6481e4af9194"},"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kubesphere%2Fkube-events","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kubesphere%2Fkube-events/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kubesphere%2Fkube-events/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kubesphere%2Fkube-events/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kubesphere","download_url":"https://codeload.github.com/kubesphere/kube-events/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254270646,"owners_count":22042859,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-31T19:00:55.948Z","updated_at":"2025-05-15T04:06:44.767Z","avatar_url":"https://github.com/kubesphere.png","language":"Go","funding_links":[],"categories":["Go"],"sub_categories":[],"readme":"# kube-events\n\nKube-events revolves around Kubernetes Event, covering multi-dimensional processing of them, such as emitting events to sinks, issuing notifications and generating alerts. In some of these dimensions, configurable filtering rules are provided to meet different business needs.\n\nKube-events contains two major business components, Exporter and Ruler. Exporter watches Kubernetes Event and emits events to sinks. Ruler receives events, filters them by rules, then issues notifications or processes them as alerts which will eventually be sent to alertmanager or webhooks. \n\nAnother component called Operator is responsible for the desired state of the previous business components. This relies on the following three crds to achieve:\n- **`Exporter`**, which defines a desired Exporter deployment. Operator ensures at all times that a Exporter matching the resource definition is running.\n- **`Ruler`**, which defines a desired Ruler deployment. The Operator ensures at all times that a Ruler matching the resource definition is running.\n- **`Rule`**, which defines a desired Rule set, which will be used to filter events by Ruler. \n\nTo learn more about the CRDs introduced by the kube-events have a look at the [design doc](doc/api.md).\n\nThe architecture diagram is as follows:  \n![Architecture](doc/images/architecture.png)\n\n# Quickstart\n\nInstall quickly kube-events into your kubernetes cluster with the following commands:\n```bash\nkubectl apply -f https://raw.githubusercontent.com/kubesphere/kube-events/master/config/bundle.yaml\nkubectl apply -f https://raw.githubusercontent.com/kubesphere/kube-events/master/config/crs/bundle.yaml\n```\n\nOr install it  by [helm chart](./helm/README.md).\n\n# Videos \u0026 blogs\n[K8s events exporting, filtering, alerting and notification in multi-tenant env](https://v.qq.com/x/page/v3130vg5lme.html)\n\n# Usage\n\n## Rule\n\n`Rule` is used to define filtering rules for events. Each `Rule` instance can be configured with a set of rules. When configuring these instances, set a label called `kubesphere.io/rule-scope` to distinguish the scope of rules, to meet the needs of multi-tenancy.\n- **`kubesphere.io/rule-scope: cluster`**  \nThis level of `Rule` does not need to specify the namespace when it is configured, it will be stored in the namespace which the operator belongs to. Filtering rules in it will be applied to the events of the entire cluster.\n- **`kubesphere.io/rule-scope: namespace`**\nWhen configuring a `Rule` instance at this level, you need to specify the namespace. Rules in it will be applied to the events whose `involvedObject.namespace` equals to the namespace which this `Rule` instance belongs to.\n- **`kubesphere.io/rule-scope: workspace`**\nThis is an intermediate level of scope control. It will act on events of multiple namespaces. It needs to be specified a label called `kubesphere.io/workspace`, which will be used to select the namespaces with the same label. Rules in it will be applied to the events whose `involvedObject.namespace` is in these selected namespaces. (It will be stored in the same namespace to the cluster-level instances)\n\n## Exporter\n\nExporter component is configured by `Exporter`. Exporter currently supports output events to stdout and webhook. In fact, Ruler component is such a webhook.\n\nIf you want to collect events from the exporter's stdout and output them to a specific place, fluentbit is a good choice. To achieve this, by [fluentbit-operator](https://github.com/kubesphere/fluentbit-operator) which provides flexibility and convenience of fluentbit configuration, just add some `Input`/`Filter`/`Output` plugins as needed. For example, the following provides plugins which will finally output events to es: \n```yaml\napiVersion: logging.kubesphere.io/v1alpha2\nkind: Input\nmetadata:\n  name: tail-events\n  namespace: kubesphere-logging-system\n  labels:\n    logging.kubesphere.io/enabled: \"true\"\n    logging.kubesphere.io/component: \"events\"\nspec:\n  tail:\n    tag: kube_events\n    path: /var/log/containers/*_kubesphere-logging-system_events-exporter*.log\n    parser: docker\n    refreshIntervalSeconds: 10\n    memBufLimit: 5MB\n    skipLongLines: true\n    db: /fluent-bit/tail/pos-events.db\n    dbSync: Normal\n---\napiVersion: logging.kubesphere.io/v1alpha2\nkind: Output\nmetadata:\n  name: es-events\n  namespace: kubesphere-logging-system\n  labels:\n    logging.kubesphere.io/enabled: \"true\"\n    logging.kubesphere.io/component: \"events\"\nspec:\n  match: kube_events\n  es:\n    host: elasticsearch-logging-data.kubesphere-logging-system.svc\n    port: 9200\n    logstashPrefix: ks-logstash-events\n    logstashFormat: true\n---\napiVersion: logging.kubesphere.io/v1alpha2\nkind: Filter\nmetadata:\n  name: filter-events\n  namespace: kubesphere-logging-system\n  labels:\n    logging.kubesphere.io/enabled: \"true\"\n    logging.kubesphere.io/component: \"events\"\nspec:\n  match: kube_events\n  filters:\n  - parser:\n      keyName: log\n      parser: json\n```\n\n## Ruler\n\nRuler component is configured by `Ruler`. Ruler component filters the received events through rules and may generate event notifications or alerts. Alert messages can be configured to be sent to the alertmanager service.\n\nAnd webhooks can be also configured to receive these notifications or alerts.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkubesphere%2Fkube-events","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkubesphere%2Fkube-events","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkubesphere%2Fkube-events/lists"}