Skip to content

mpatters72/kube-cron-slack

Repository files navigation

kube-cron-slack

Kubernetes Slack Notification Cron Job POC

DockerHub Image

https://hub.docker.com/r/mpatters72/kube-cron-slack/

Create a Slack Webhook URI

https://my.slack.com/services/new/incoming-webhook

Setup Secrets

Copy Template

cp templates/kube-cron-slack-secret.yaml /tmp/

Get base64 encoded values

https://kubernetes.io/docs/concepts/configuration/secret/#creating-a-secret-manually

  • Use the webhook URI you generated here and your desired slack channel
echo -n 'https://hooks.slack.com/services/UseYour/RealChannel/URIHERE' | base64
aHR0cHM6Ly9ob29rcy5zbGFjay5jb20vc2VydmljZXMvVXNlWW91ci9SZWFsQ2hhbm5lbC9VUklIRVJF
echo -n '#my-slack-channel' | base64
I215LXNsYWNrLWNoYW5uZWw=

Replace base64 files in new file tmp/kube-cron-slack-secret.yaml

Add secret to kubernetes

kubectl apply -f /tmp/kube-cron-slack-secret.yaml

Verify

kubectl get secret kube-cron-slack -o yaml

Setup CronJob

Double-check settings in templates/kube-cron-slack-cronjob

Copy template and make any desired edits and apply it

cp templates/kube-cron-slack-cronjob.yaml /tmp
# make any edits to /tmp/kube-cron-slack-cronjob.yaml
# apply it
kubectl apply -f /tmp/kube-cron-slack-cronjob.yaml

Troubleshooting

kubectl get cronjob
kubectl get jobs --watch

About

Kubernetes Slack Notification Cron Job POC

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published