Kubernetes deployment update alert.?

4/24/2019

I have kubernetes cluster with more thane 50 pods. I want to get alerted on email when an update happens with pod and another kubernetes resource. if anyone doing manual deployment like that, how I can achieve this is in Linux.

-- Raghunath Babalsure
azure-aks
docker
google-kubernetes-engine
kubernetes

3 Answers

4/24/2019

If you have Prometheus then you can create alert like changes(kube_deployment_status_observed_generation[5m]) > 0 which means that deployment was changed at least once for last 5 minutes.

If you don't have Prometheus - then you may install quite fast using this repo: https://github.com/coreos/prometheus-operator

-- Vasily Angapov
Source: StackOverflow

4/24/2019

It sounds like you want to be notified of changes initiated by manual kubectl commands. To my knowledge Kubernetes doesn't support that use case out of the box, but you might be able to use Auditing to get what you want. This should give you a complete picture of who does what in your cluster.

In that link there are various suggestions how to use the logs, for example aggregate them with fluentd or push them via webhook to logstash. These should have further extension points you can map email alerts to, but this depends a lot on your infrastructure and current setup.

If you want to stay within the cluster completely, you could even create a Cron Job to email you any new actions from the audit log every so often.

Hope this helps.

-- rath
Source: StackOverflow

4/24/2019

look at prometheus including alert manager. define rules in prometheus to send an alert via alert manager when an update event is fired.

-- P Ekambaram
Source: StackOverflow