<p>I want to autoscale a pod based on how many threads a container uses, so:
if container threads &gt; 10 then scale from 1 -&gt; 2.
Is this possible?</p>
<p>CPU utilization as metric is not going to work unfortunately.</p>
<p>Haven't found anything on this yet</p>

dahol
<p>As mentioned by David Maze, Kubernetes does not track this as a statistic on its own, however if you have another metric system that is linked to HPA, it should be doable.</p>
<ol>
<li><p>Try to gather metrics on the number of threads used by the container using a monitoring tool such as Prometheus.</p>
</li>
<li><p>Create a custom auto scaling script that checks the thread count using the monitoring tool's API and triggers a scaling event if it reaches 10.</p>
</li>
<li><p>Scale pods using K8S HPA based on a defined metric.</p>
</li>
</ol>
<p>Refer to the doc <a href="https://cloud.google.com/monitoring/custom-metrics" rel="nofollow noreferrer">User-defined metrics overview</a> for more information.</p>
