My deployment in Kubernetes takes a couple of minutes to initialize, and it has an increased CPU usage during that period. I need a way to wait and disregard CPU metrics from the initialization period for the horizontal autoscaling metrics.
There is a question which asks just that, and the answer mentions some relevant flags --horizontal-pod-autoscaler-initial-readiness-delay
and --horizontal-pod-autoscaler-cpu-initialization-period
. But, after reading the Kubernetes documentation and finding some Kubernetes' Github issue, I still don't quite understand the exact effect from the flags and how to apply them at all: kubectl autoscale
doesn't seem to accept them in any form.
This 3rd-party documentation demonstrates how to specify these values in yaml but it uses some custom API version and their configuration doesn't work for autoscaling/v2beta2
.
How these flags are supposed to be put to use?