Skip to content

pidah/k8s-event-notifier

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

k8s-event-notifier

A simple k8s events notifier to slack.

Overview

The kubernetes Events API streams a lot of information, useful to Operations folk and application Developers. This simple tool allows you to filter the events object based on reason as follows:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: k8s-event-notifier
  namespace: kube-system
  labels:
    app: k8s-event-notifier
spec:
  replicas: 1
  selector:
    matchLabels:
      app: k8s-event-notifier
  template:
    metadata:
      labels:
        app: k8s-event-notifier
    spec:
      containers:
      - name: k8s-event-notifier
        env:
        - name: EVENT_FILTER
          value: BackOff,Failed,FailedScheduling,Killing
        - name: SLACK_API_URL
          value: https://hooks.slack.com/services/RANDOM12/BFMADBNDS/0cYHvK1a9xviCsjakjawTMaa
        image: ghcr.io/pidah/k8s-event-notifier:master
        command: ["/k8s-event-notifier"]
        args:
        - --logtostderr
        - -v=4
         2>&1

You can pass a comma-separated list of event reasons to the EVENT_FILTER as shown above. Note that by default, if no EVENT_FILTER is specified, no event will be captured.

Once an interesting event is detected, a notification will be sent to slack using the specified slack incoming webhook url SLACK_API_URL as shown above.

Install

Checkout this repo and you can use this example deployment manifest file as follows:

kubectl create -f manifests/deployment.yaml

and a sample RBAC manifest file if required:

kubectl create -f manifests/rbac.yaml

About

No description or website provided.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages