Tried to find a solution for a project, not sure can K8s do that by itself or need a third-party tool to get involved.

For example, I have 3 Nginx containers to provide load balance for our web service. I would like to let K8s monitor CPU/Memory/Network Traffic usage of the Pod and set up the metric. Once the utilization over than metric the master will create more Nginx automatically.

I am very new to K8s, any help is appreciated!

1 Answer 1


What you are looking for is the Horizontal Pod Autoscaler:

The Horizontal Pod Autoscaler automatically scales the number of Pods in a replication controller, deployment, replica set or stateful set based on observed CPU utilization (or, with custom metrics support, on some other application-provided metrics).

The docs above will provide you with info regarding the idea behind that mechanism and the ways of implementing it.

If you would like to scale based on metrics other than just CPU usage than you need to use the custom metrics:

Kubernetes 1.6 adds support for making use of custom metrics in the Horizontal Pod Autoscaler. You can add custom metrics for the Horizontal Pod Autoscaler to use in the autoscaling/v2beta2 API. Kubernetes then queries the new custom metrics API to fetch the values of the appropriate custom metrics.

Below you will find some useful sources with guides and examples:

  • 2
    Thanks for your reply, I took your advice to build a POC environment by using Permouns + Grafana + Horizontal Pod Autoscaler. The result is as my expected. Thank you so much!
    – ITnewbie
    May 17, 2021 at 2:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .