<p>I have a Kubernetes service running and we have an external API's dependent on this service.</p>

<p>We would like to be notified if there is any service restart. Is there any possibility to hit an API endpoint on every service restart?</p>

umesh dc
<p>Hi and welcome to the community!</p>

<p>There are multiple ways of achieve this. A really simple one (as pointed out by Thomas) is an Init Container. Refer to the <a href="https://kubernetes.io/docs/concepts/workloads/pods/init-containers/" rel="nofollow noreferrer">Kubernetes docs</a> for more on how to get those running! This init container would do nothing more than send out an HTTP request to your external API once the pod is started and terminate immediately afterwards.</p>

<p>The other way is much more complex and will require you to write some code yourself. What you'd have to do is write your own controller that watches the entities through the Kubernetes API and notify your external service when a pod is rescheduled, killed, died etc.
(You could however have your external service to exactly that why accessing the kube-api directly...)</p>
