https://github.com/pidah/k8s-event-notifier
https://github.com/pidah/k8s-event-notifier
events golang kubernetes slack
Last synced: 5 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/pidah/k8s-event-notifier
- Owner: pidah
- Created: 2019-01-30T10:39:24.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2022-02-03T10:45:12.000Z (over 4 years ago)
- Last Synced: 2025-08-02T19:49:27.289Z (11 months ago)
- Topics: events, golang, kubernetes, slack
- Language: Go
- Size: 2.2 MB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 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](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.13/#event-v1-core) 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](https://github.com/pearsontechnology/k8s-event-notifier/blob/master/manifests/deployment.yaml) as follows:
```
kubectl create -f manifests/deployment.yaml
```
and a sample [RBAC manifest file](https://github.com/pearsontechnology/k8s-event-notifier/blob/master/manifests/rbac.yaml) if required:
```
kubectl create -f manifests/rbac.yaml
```