HorizontalPodAutoscaler Memory CPU calculation details explored in OpenShift 4

Solution In Progress - Updated -

Issue

Illustrated below is an instance showcasing the outcome when utilizing HPA API version 2, employing memory and CPU metrics as benchmarks for automatic scaling:

$ oc get hpa -n nginx
NAMESPACE   NAME            REFERENCE                    TARGETS             MINPODS   MAXPODS   REPLICAS   AGE
nginx       nginx-ingress   Deployment/nginx-ingress     4%/50%, 6%/50%    2         10        2          198d

Let's begin by comprehensively grasping the output delivered by the aforementioned command. Within the "nginx" namespace, there exists a deployment labeled as "nginx-ingress," managed by an HPA named "nginx-ingress."

The HPA is employed in this context to dynamically expand or contract the specified deployment, ensuring a minimum of 2 pods and a maximum of 10. Presently, this deployment houses 2 pods (termed replicas), executing the responsibilities of an NGINX Ingress Controller.

In the configuration of this cluster, the term "targets" denotes the utilization of memory metrics (4%/50%). Here, the prevailing computed average memory usage registers at 4%, while the designated scaling threshold is set at 50%. Similarly, the second metric pertains to CPU (6%/50%), applying an identical rationale.

Environment

  • Red Hat OpenShift Container Platform 4 [RHOCP]

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content