<p>Concerning the <a href="https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale" rel="nofollow noreferrer">Kubernetes Horizontal Autoscaler</a>, are there any metrics related to the number of changes between certain time periods?</p>

Hegemon
<p>Kubernetes does not provide such metrics, but you can get <code>events</code> for a k8s resource.</p>
<blockquote>
<p>An event in Kubernetes is an object in the framework that is automatically generated in response to changes with other resources—like nodes, pods, or containers.</p>
</blockquote>
<p>The simplest way to get events for HPA:</p>
<pre class="lang-yaml prettyprint-override"><code>$ kubectl get events | grep HorizontalPodAutoscaler
7m5s        Normal    SuccessfulRescale              HorizontalPodAutoscaler   New size: 8; reason: cpu resource utilization (percentage of request) above target
3m20s       Normal    SuccessfulRescale              HorizontalPodAutoscaler   New size: 10; reason:
</code></pre>
<p>or</p>
<pre><code>$ kubectl describe hpa &lt;yourHpaName&gt;
</code></pre>
<p><strong>But</strong> Kubernetes events are deleted by default after 1 hour (it is the default time-to-live, higher values might require more resources for <code>etcd</code>). Therefore <strong>you must watch for and collect important events as they happen</strong>.</p>
<p>To do this you can use for example:</p>
<ul>
<li><a href="https://github.com/bitnami-labs/kubewatch" rel="nofollow noreferrer">KubeWatch</a> is great open-source tool for watching and streaming K8s events to third-party tools and webhooks.</li>
<li><a href="https://github.com/heptiolabs/eventrouter?ref=thechiefio" rel="nofollow noreferrer">EventRouter</a> is another great open-source tool for collecting Kubernetes events. It is effortless to set up and aims to stream Kubernetes events to multiple sources or <em>sinks</em> as they are referred to in its documentation. However, just like KubeWatch, it also does not offer querying or persistence features. You need to connect it with a third-party storage and analysis tool for a full-fledged experience.</li>
<li>almost any logging tool for k8s.</li>
</ul>
<p><strong>Also</strong>, you can use the <a href="https://kubernetes.io/docs/reference/using-api/client-libraries/" rel="nofollow noreferrer">official Kubernetes API library</a> to develop some simple app for catching events from HPA.
There is a good example of how to develop a simple monitoring app for k8s by yourself <a href="https://stackoverflow.com/a/63774000/17739440">in this answer</a>. They monitor pods' statuses there, but you can get a good idea of developing the app you need.</p>
