Is it possible to start or stop pods based on some events?

7/13/2019

Is it possible to start or stop Kubernets PODS based on some events like a Kafka event?

For e.g., if there is an event that some work is complete and based on that I want to bring down a POD or bring a POD up. In my case, minimum replicas of the PODs keep running even though they are not required to be running for the most part of the day.

-- Ashish Abrol
kubernetes
microservices

1 Answer

7/13/2019

Pods with Horizontal Pod Autoscaling based on custom metrics is the option you are looking for.

Probably you instrument your code with custom Prometheus metrics. In your case it is publishing a metric in Prometheus that says the number of messages available for processing at a point in time. Then use that custom Prometheus metric to scale pods on that basis.

-- Malathi
Source: StackOverflow