How to get notified on pod restart?

8/21/2017

I have applications running fine on GKE. Recently, there was a 3rd party API causing the server to crash. Luckily, I set up livenessProbe earlier and the pod managed to restart, and everyone was happy.

I would like to get notified when the pod is started. Do you know how to get notified?

-- Grace Shao
google-kubernetes-engine
kubernetes

1 Answer

8/22/2017

There are lifecycle hooks that could work for your case: https://kubernetes.io/docs/tasks/configure-pod-container/attach-handler-lifecycle-event/

You could set a pre-start hook that, for instance, sends a post request to an API endpoint, or you could configure mail so you receive the notification in your mail.

-- Javier Salmeron
Source: StackOverflow