Reputation: 377
Is there any way to know that the number of pods have scaled up or down as a result of Horizontal Pod Autoscaling apart from kubectl get hpa command?
I want to trigger a particular file on every scale up or scale down of pods
Upvotes: 1
Views: 524
Reputation: 853
You can use status field of HPA to know when was last time HPA was executed. Details about this can be found with below command:
kubectl explain hpa.status
from this status , you can use lastScaleTime filed for your problem.
lastScaleTime <string>
last time the HorizontalPodAutoscaler scaled the number of pods; used by
the autoscaler to control how often the number of pods is changed.
Upvotes: 1