Kubernetes Events Slack Bot (slack8s)
Kubernetes Slack Integration - Infinite loop go program which queries the Kubernetes Event Stream API and
posts messages to slack for important events.
Building
Given this is an active work in progress, you'll probably want to modify
and build the code yourself. If you just want to get started quickly,
use the image in docker hub.
docker build .
- Tag and push to your favorite registry
Running
- Create a new Slack Bot.
- Copy the example configmap file:
cp examples/example.slack8s-configmap.yaml examples/slack8s-configmap.yaml
- Modify
slack-token
and slack-channel
variables in your new file.
- Create the config map using kubectl:
kubectl create -f examples/slack8s-configmap.yaml
- Create the slack8s deployment:
kubectl create -f examples/slack8s-deployment.yaml
Limitations
- This does not keep track of which notifications it has sent. You should not
trust that slack has every event.
- When the container dies, if the container takes more than 1 minute to spawn,
some events will not be posted to slack.
- When the container dies, events within 1 minute of the restart will be posted
to Slack twice.
- The watch api seems to hit EOF causing this container to die more often than
desired. On a busy cluster, the above limitations are more obvious because of this.
- Do not attempt to use this as a replacement for a pager.
Todo
- Refactor the way in which the types of alerts to send to slack are configured
- Add more types of alerts which get posted to slack
- Better formatting of slack attachment output
- Alerting thresholds