# Understanding K8s scaling

PerfectScale's agent (stateless deployment, one per K8s cluster) continuously observes scaling, resiliency, and performance metrics across the entire K8s stack, including workloads, infrastructure, etc.

The agent is constantly looking for two types of issues:

* Risky under-provisioning or missing definitions that could harm uptime and SLA.
* Over-provisioning, where compute resources are constantly underutilized, results in waste and excessive CO2 emissions.

Those issues could affect Vertical Scaling, Horizontal Scaling, or both.

## Vertical scaling&#x20;

Vertical scaling refers to the amount of resources (such as CPU and memory) allocated to a particular instance, like a Container, Pod, Node, etc. When we scale up or down vertically, we modify the amount of resources available for each instance.

\
To achieve proper scheduling and runtime, all Pods' containers should have defined resources (requests, and in many cases, limits), and underlying infrastructure (worker nodes) should have the proper resource capacity to host the Pods (containers).

## Horizontal scaling&#x20;

Horizontal scaling refers to parallelization. To achieve the desired level of performance or resiliency, we might need multiple instances of the same workload or infrastructure (to ensure High Availability, processing parallelization, etc.)

Kubernetes and the open-source community provide multiple tools to control horizontal scaling. However, those should be tuned appropriately to bring the desired values.

PerfectScale supports the following horizontal scaling products/solutions :

* HorizontalPodAutoscaler
* Keda
* ClusterAutoscaler
* AWS Karpenter
* GCP Autopilot


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.perfectscale.io/product-overview/understanding-k8s-scaling.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
