Skip to content
Français
Account: not signed in, sync available My learning
Select theme
Français

Horizontal Pod Autoscaler (HPA): automatic scaling in Kubernetes

By updated

Improve this page

Logo Kubernetes

The Horizontal Pod Autoscaler (HPA) automatically changes the number of replicas of an application to follow its load. Every 15 seconds, it reads the consumption of your Pods, compares it with a target you set, and adds or removes Pods. This lesson, written for Kubernetes 1.37, teaches you to create an autoscaling/v2 HPA on CPU or memory, to tune its speed with behavior, and to understand why its TARGETS column sometimes stays empty.

What you will learn

  • Explain how the HPA computes the number of replicas it wants
  • Declare requests and install metrics-server, the two prerequisites of the HPA
  • Create an HPA in YAML and with kubectl autoscale
  • Tune the speed of scale-up and scale-down with behavior
  • Trigger scaling under load and read it in kubectl get hpa
  • Diagnose an empty TARGETS, an HPA that does not move, or a kubectl scale that gets undone

Prerequisites

You know what the requests and limits of a container are, and you have already created a Deployment. A kind cluster on Kubernetes 1.37, like the one in the course, is enough.

What is the HPA for?

The HPA keeps a target utilization by adjusting the number of Pods. It does not react to an event but to a measurement: every 15 seconds by default, it compares the observed value with the threshold and decides. When no metric comes in, it does nothing, and it does not fall back to a default number of replicas.

SituationHPA action
High load (metric above the target)Adds replicas
Low load (metric below the target)Removes replicas, cautiously
Metrics missing for some of the PodsCautious decision: the HPA assumes a value for those Pods, which dampens both scale-up and scale-down

HPA vs VPA vs Cluster Autoscaler

The HPA changes the number of Pods. The Vertical Pod Autoscaler (VPA) changes their size, and the Cluster Autoscaler changes the number of nodes. The choice between the three, and the rule that forbids letting the HPA and the VPA manage the same metric, are in the lesson Choose your autoscaler. The VPA has its own lesson: Resize a Pod's resources.

Preconditions

For an HPA that follows CPU or memory, two things are essential: metrics-server, which provides the measurements, and requests on the Pods, which give the HPA something to compute a percentage from. Without either one, the HPA is created without error and does nothing.

1. Metrics Server must be installed

The HPA reads its CPU and memory measurements from the metrics.k8s.io API, which Metrics Server serves. Check that it answers:

Terminal window
kubectl get deployment -n kube-system metrics-server
kubectl top nodes

If kubectl top nodes shows CPU and memory values, Metrics Server works. Otherwise, install it with the v0.9.1 manifest, the latest release as of 2026-10-29:

Terminal window
kubectl apply -f https://github.com/kubernetes-sigs/metrics-server/releases/download/v0.9.1/components.yaml

On the course's kind cluster, this manifest alone is not enough: the metrics-server Pod stays at 0/1 until you add the --kubelet-insecure-tls option to it, which is reserved for a learning cluster. The fix and its justification are in the lesson Read the cluster state. If you followed it, metrics-server is already in place.

The first measurements do not arrive right away. On the reference cluster, they arrived 35 seconds after the installation, and kubectl top nodes failed with error: Metrics API not available during that delay. Wait for kubectl top nodes to answer before concluding that something is broken.

2. Pods must declare their requests

For a percentage target (averageUtilization), the HPA computes:

Utilization = (current consumption / request) × 100

Without requests, it has no denominator, cannot compute any percentage, and leaves TARGETS without a value. Here is the minimum to declare in the container:

resources:
requests:
cpu: "50m"
memory: "32Mi"

The HPA computes its ratio on the requests, never on the limits. Limits protect the node: they cap consumption and trigger CPU throttling or the OOMKill, but they take no part in any HPA calculation. A manifest that declares only limits still gives the HPA a denominator: Kubernetes copies the limit into the request when it stores the Pod. A LimitRange in the namespace can also set default values. So do not trust the manifest you wrote: read the resource as stored by the API.

The following command displays the effective resources of a Pod's containers:

Terminal window
kubectl get pod <name> -o jsonpath='{.spec.containers[*].resources}'

The rule that holds: an HPA in Utilization mode needs an effective request, wherever it comes from.

How does the HPA decide the number of replicas?

The calculation is simple to state, but a few safeguards explain most of the behaviors that look odd. Read the formula first, then the corrections that come with it: an HPA that does not act is most often applying its rule to the letter.

The base formula

The HPA reasons on a ratio: it divides the observed average utilization by the target, multiplies the current number of replicas by that ratio, then rounds up to the next integer.

Desired replicas = Current replicas × (Current utilization / Target)

With 2 Pods at 80% utilization and a 50% target, the calculation gives 2 × (80 / 50) = 3.2, that is 4 Pods.

Actual behavior (more nuanced)

The formula gives the principle, and the HPA also applies four rules:

  • a default tolerance of 10%: as long as utilization stays within 10% of the target, the HPA changes nothing, which avoids oscillations. With a 50% target, it does not move between 45% and 55%;
  • the exclusion of Pods that are not Ready or are being deleted from the calculation;
  • a 5-minute stabilization window before reducing the number of replicas;
  • the dampening when metrics are missing: for a Pod without a measurement, the HPA assumes 100% of the target when it considers scaling down and 0% when it considers scaling up, which reduces the size of the change without forbidding it.

The tolerance is set per HPA: the tolerance field of spec.behavior.scaleUp and spec.behavior.scaleDown replaces the 10% value for that HPA. It is written as a fraction, for example 0.05 for 5%. Scale-up and scale-down can each have their own. This feature has been enabled by default since Kubernetes 1.35 and is stable in 1.37. The table of behavior parameters, further down, lists it with the other fields.

Scaling up is fast, because it answers the load. Scaling down is deliberately slow: the HPA waits 5 minutes of stabilization before removing replicas, so as not to delete a capacity you would need again thirty seconds later.

Minimal example: a CPU-based HPA

The example has three inseparable pieces: a Deployment with requests, a Service to receive the load, and the HPA. Removing the requests from the Deployment is enough to make the HPA inoperative.

Deployment with requests

The Deployment starts with a single replica, and the HPA takes over afterwards. The requests.cpu: "50m" (one twentieth of a core) is the denominator: it is this value, and not the 200m limit, that decides from which consumption the 50% threshold is crossed, that is 25m per Pod.

web.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: web
spec:
replicas: 1
selector:
matchLabels:
app: web
template:
metadata:
labels:
app: web
spec:
containers:
- name: nginx
image: nginx:1.30.5@sha256:9bf97bd7714f5e24c1ccd545ecb9eb5435cb6d109c97cebb15e7e455e0239edb
ports:
- containerPort: 80
resources:
requests:
cpu: 50m
memory: 32Mi
limits:
cpu: 200m
memory: 64Mi
---
apiVersion: v1
kind: Service
metadata:
name: web
spec:
selector:
app: web
ports:
- port: 80

Create the HPA

The scaleTargetRef field designates the object to resize, here the Deployment by its exact name. A typo gives an HPA that is created without error and drives nothing. minReplicas and maxReplicas bound the allowed range, and the maximum protects the cluster from an uncontrolled scale-up.

web-hpa.yaml
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: web
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: web
minReplicas: 1
maxReplicas: 4
metrics:
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: 50

This HPA keeps the average CPU utilization of the Pods around 50% of their request. Above it, it adds Pods. Below it, it removes them after the stabilization.

Apply and check

The TARGETS column is the one to watch: it shows the current measurement, then the target.

Terminal window
kubectl apply -f web.yaml
kubectl apply -f web-hpa.yaml
kubectl get hpa
Output, right after creation
NAME REFERENCE TARGETS MINPODS MAXPODS REPLICAS AGE
web Deployment/web cpu: <unknown>/50% 1 4 1 0s

The HPA has no measurement yet: <unknown> does not signal a configuration error. On the reference cluster, the metrics arrived between 30 and 45 seconds later:

Output, once the metrics have arrived
NAME REFERENCE TARGETS MINPODS MAXPODS REPLICAS AGE
web Deployment/web cpu: 0%/50% 1 4 1 45s

The metric name comes before the value: cpu: 0%/50% reads "CPU, 0% consumed, target 50%". For an External or Object metric with an average-value target, the column writes x/y (avg). Beyond two metrics, it ends with + N more...: kubectl describe hpa then lists them all.

Which metric types are supported?

The autoscaling/v2 HPA accepts four metric types. The Resource type covers almost every need; the other three require a metrics adapter, presented further down.

TypeDescriptionExample
ResourceCPU and memory of the containersaverageUtilization: 50
PodsMetric aggregated per PodRequests per second per Pod
ObjectMetric tied to a Kubernetes objectRequests on an Ingress
ExternalMetric from outside the clusterLength of a message queue

Example with several metrics

Combining CPU and memory covers an application whose load shows up sometimes as computation, sometimes as memory occupation. The two entries are independent and each carries its own threshold.

apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: multi-metric-hpa
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: my-app
minReplicas: 2
maxReplicas: 20
metrics:
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: 60
- type: Resource
resource:
name: memory
target:
type: Utilization
averageUtilization: 70

With several metrics, the HPA computes the number of replicas required for each one and keeps the maximum. All the metrics therefore stay under their threshold.

Custom and external metrics

A Pods, Object or External metric requires a metrics adapter, for example Prometheus Adapter, which exposes Prometheus metrics to the Kubernetes API. Metrics Server is enough only for CPU and memory. The lesson Choose your autoscaler details where the HPA metrics come from.

Control scaling speed with behavior

The behavior field tunes scale-up (scaleUp) and scale-down (scaleDown) separately. Two notions add up there and are often confused. The stabilization window decides when the HPA is allowed to act, by smoothing the recommendations over a period. The policies decide by how much it may move over a given interval.

apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: controlled-hpa
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: my-app
minReplicas: 2
maxReplicas: 50
metrics:
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: 50
behavior:
scaleDown:
stabilizationWindowSeconds: 300 # wait 5 min before reducing
policies:
- type: Percent
value: 10 # reduce by 10% at most per period
periodSeconds: 60
scaleUp:
stabilizationWindowSeconds: 0 # scale up immediately
policies:
- type: Percent
value: 100 # double if needed
periodSeconds: 15
- type: Pods
value: 4 # or add 4 Pods at most
periodSeconds: 15
selectPolicy: Max # pick the most aggressive policy

The behavior parameters

The fields below are declared under scaleUp or scaleDown. The most useful day to day is stabilizationWindowSeconds, which sets how cautious the scale-down is.

ParameterDescriptionDefault
stabilizationWindowSecondsWindow over which the HPA keeps the most cautious recommendation300 s (scale-down), 0 s (scale-up)
policies[].typePods (absolute number) or Percent-
policies[].valueSize of the change-
policies[].periodSecondsEvaluation period-
selectPolicyMax, Min or DisabledMax
toleranceDeviation tolerated around the target before acting, specific to this HPA10% (cluster-wide value)

If your HPA oscillates between scaling up and down, increase stabilizationWindowSeconds on the scaleDown side: this smooths the load variations. A complete example is given in the troubleshooting section "The HPA flaps".

Can you scale down to zero replicas?

Yes: on Kubernetes 1.37, minReplicas: 0 is accepted without enabling anything, because the HPAScaleToZero feature gate is Beta and enabled by default. It requires an Object or External metric, never CPU or memory, since no Pod is running to measure them. When the event source has no adapter, KEDA provides one: it drives the standard HPA and advertises "70+ scalers", listed on keda.sh. The details are in the lesson Choose your autoscaler, and scale-to-zero of an HTTP service is practiced with Knative Serving (in French).

Test the scaling

An HPA that has never scaled is not validated. The test consists of generating enough load to cross the threshold, watching the scale-up, then cutting the load and checking the scale-down. Rather than installing a tool on your machine, run the load from a Pod in the cluster: it calls the web Service in a loop.

Terminal window
kubectl run charge-http --image=busybox:1.38.0@sha256:a46257e06c82ad85242d0d38077d0a52d9896389ca60a1a59d3463db586e5fa4 --restart=Never -- sh -c 'while true; do wget -q -O- http://web >/dev/null; done'

In another terminal, sample the HPA state every 20 seconds, for example with kubectl get hpa --no-headers in a loop. Here is what the sampling gave on the reference cluster:

HPA sampling under load
+0s web Deployment/web cpu: 0%/50% 1 4 1
+21s web Deployment/web cpu: 0%/50% 1 4 1
+41s web Deployment/web cpu: 142%/50% 1 4 1
+61s web Deployment/web cpu: 42%/50% 1 4 3
+81s web Deployment/web cpu: 26%/50% 1 4 3
+121s web Deployment/web cpu: 55%/50% 1 4 3

Look at the +41s line: utilization is 142% for a 50% target. The calculation gives 1 × (142 / 50) = 2.84, rounded up to 3 replicas, and that is indeed what the HPA decided before the next sample. Once the three Pods are in place, utilization drops, then climbs back to 55% without triggering a new scale-up: that 55% is at the edge of the 10% tolerance.

The HPA leaves a trace of its decision in an event:

Terminal window
kubectl get events --field-selector reason=SuccessfulRescale
Output
LAST SEEN TYPE REASON OBJECT MESSAGE
91s Normal SuccessfulRescale horizontalpodautoscaler/web New size: 3; reason: cpu resource utilization (percentage of request) above target

To test the scale-down, stop the load with kubectl delete pod charge-http, then wait at least 5 minutes: the stabilization window keeps the highest recommendation of that period before reducing. This asymmetry between scale-up and scale-down is intentional.

Debug an HPA

When an HPA does nothing, the cause is most often upstream of it: missing metrics, missing requests or a badly designated target. Walk up the chain from the HPA to Metrics Server rather than adjusting thresholds at random.

Essential commands

kubectl get hpa gives the state in one line. kubectl describe hpa provides the conditions and the events, which contain the exact error message. The two kubectl top commands then check that Metrics Server answers, independently of the HPA.

Terminal window
kubectl get hpa
kubectl describe hpa web
kubectl get hpa web -o yaml
kubectl top pods -l app=web
kubectl top nodes

Read the HPA conditions

The Conditions part of kubectl describe hpa web explains the state of the HPA. On Kubernetes 1.37, it has four lines:

Output (excerpt)
Conditions:
Type Status Reason Message
---- ------ ------ -------
AbleToScale True ReadyForNewScale recommended size matches current size
ScalingActive True ValidMetricFound the HPA was able to successfully calculate a replica count from cpu resource utilization (percentage of request)
ScalingLimited False DesiredWithinRange the desired count is within the acceptable range
ScaledToZero False NotScaledToZero the HPA controller did not scale the workload to zero

Read them from top to bottom: can the HPA act, does it have a valid metric, is it blocked by its bounds, has it brought the workload down to zero. The table gives the meaning of each condition.

ConditionMeaning
AbleToScale: TrueThe HPA can change the number of replicas
ScalingActive: TrueThe metrics are available and valid
ScalingLimited: TrueThe HPA is blocked by minReplicas or maxReplicas
ScaledToZero: TrueThe HPA has brought the workload down to zero replicas (visible on Kubernetes 1.37)

Common problems and solutions

The TARGETS: cpu: <unknown>/50% symptom appears on three lines of the table: two lasting causes, missing requests and missing Metrics Server, plus the wait for the first collection. The display is identical in the three cases, and only the message of kubectl describe hpa settles it.

SymptomLikely causeSolution
cpu: <unknown>/50%No requests definedAdd resources.requests to the Deployment
cpu: <unknown>/50%Metrics Server missingInstall Metrics Server
cpu: <unknown>/50%First collection not done yetWait until kubectl top nodes answers, then read kubectl describe hpa again
ScalingActive: FalseMetric not foundCheck the metric name
HPA does not scale upLoad too low or within the toleranceIncrease the test load
HPA does not scale downStabilization windowWait 5 minutes or more
ScalingLimited: TruemaxReplicas reachedIncrease maxReplicas

Detailed debugging

If the conditions are not enough, query the metrics API directly. It is served by Metrics Server itself, not by the API server, and metrics-server v0.9.1 serves only one version of it, v1beta1:

Terminal window
kubectl get apiservices | grep metrics
Output
v1beta1.metrics.k8s.io kube-system/metrics-server True 36s

The third field, AVAILABLE, must be True. A call on metrics.k8s.io/v1 fails with Error from server (NotFound), which is normal: that version does not exist. So query v1beta1:

Terminal window
kubectl get --raw "/apis/metrics.k8s.io/v1beta1/namespaces/default/pods"
Output
{"kind":"PodMetricsList","apiVersion":"metrics.k8s.io/v1beta1","metadata":{},"items":[]}

An empty items list while Pods are running in the namespace proves that the problem comes from Metrics Server, not from the HPA. Here it is empty because the default namespace had no Pod.

Create an HPA from the command line

kubectl autoscale creates an HPA without writing any YAML, which saves time for a quick trial. With kubectl 1.37, the object created is an autoscaling/v2 and the command accepts a CPU target (--cpu) and a memory target (--memory).

Terminal window
kubectl autoscale deployment web --cpu=50% --min=1 --max=4
Output
horizontalpodautoscaler.autoscaling/web autoscaled

The value of --cpu and --memory changes meaning depending on its unit. With a percentage (--cpu=50%), the HPA aims for an average utilization relative to the requests, like averageUtilization in the YAML. With a quantity (--cpu=500m, --memory=200Mi), it aims for an absolute average value per Pod.

The old --cpu-percent=50 option still works, but kubectl prints this warning before creating the HPA: Flag --cpu-percent has been deprecated, Use --cpu with percentage or resource quantity format (e.g., '70%' for utilization or '500m' for milliCPU). So write --cpu=50%.

The command can set neither a behavior block nor a Pods, Object or External metric. As soon as you need one, start from the YAML it generates and complete it.

Generate the YAML

--dry-run=client builds the object locally without sending it to the API, and -o yaml writes it to standard output. It is the fastest way to get a correct skeleton, to enrich afterwards.

Terminal window
kubectl autoscale deployment web \
--cpu=50% --memory=70% --min=1 --max=10 \
--dry-run=client -o yaml > hpa.yaml

The file contains the two Resource metrics of the multi-metric example, in autoscaling/v2:

hpa.yaml (excerpt)
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
spec:
maxReplicas: 10
metrics:
- resource:
name: cpu
target:
averageUtilization: 50
type: Utilization
type: Resource
- resource:
name: memory
target:
averageUtilization: 70
type: Utilization
type: Resource

Modify or delete an HPA

kubectl patch raises maxReplicas without replaying the whole manifest, and kubectl delete removes the HPA.

Terminal window
kubectl patch hpa web -p '{"spec":{"maxReplicas":20}}'
kubectl delete hpa web

Deleting the HPA does not touch the Deployment: it keeps the last number of replicas set by the autoscaler, and nothing makes it vary anymore. To go back to a precise value, set it afterwards with kubectl scale, which then becomes the only driver again.

Troubleshooting

Four situations come back again and again and look alike from a distance: the HPA gets no metric, it gets metrics but stays still, it undoes a manual scale, or it moves too much. Each has a distinct cause and fix.

TARGETS stays empty: two causes, two messages

kubectl get hpa shows the same thing in both cases, and that is what wastes time:

Output
NAME REFERENCE TARGETS MINPODS MAXPODS REPLICAS
sans-requests Deployment/sans-requests cpu: <unknown>/50% 1 5 1
avec-requests Deployment/avec-requests cpu: 0%/50% 1 5 1

kubectl describe hpa settles it, and the two messages have nothing in common. A third, temporary situation adds to the two lasting causes: during the first seconds after creation, TARGETS stays empty while the first collection arrives, and this is not a failure.

Cause 1, Metrics Server is missing. The metrics API does not exist at all, and the message says so clearly:

Output
ScalingActive False FailedGetResourceMetric
failed to get cpu utilization: unable to fetch metrics from resource metrics
API: the server could not find the requested resource (get pods.metrics.k8s.io)

Remember pods.metrics.k8s.io: it is the signature of this case.

Cause 2, the requests are missing. Metrics Server works, but the HPA cannot compute any percentage for lack of a denominator. Once the first measurements are available, the ScalingActive condition says so bluntly (message captured on Kubernetes 1.37.0 with metrics-server v0.9.1):

Output
ScalingActive False FailedGetResourceMetric
the HPA was unable to compute the replica count: failed to get cpu
utilization: missing request for cpu in container web of Pod
sans-requests-c488c9d8d-9b4hw

The message names the resource (cpu), the container (web) and the Pod: you just need to add a CPU request to that container. In the measurement, it appeared 3 min 14 s after the first answer of kubectl top nodes, and it then repeated at every evaluation of the HPA.

The first message you see is misleading. Right after an HPA is created, during the first collection of metrics-server, the events say something else: first the server is currently unable to handle the request, then no metrics returned from resource metrics API. They say that the metrics API is not ready yet, not that the requests are missing, and they disappear on their own. Wait for kubectl top nodes to answer, run kubectl describe hpa again and read the ScalingActive condition, not the first events in the list: it is the one that carries the lasting cause.

The diagnostic sequence follows this order:

Terminal window
# 1. does the metrics API answer at all?
kubectl top nodes
# 2. if so, does the Deployment declare requests?
kubectl get deployment mon-app -o jsonpath='{.spec.template.spec.containers[*].resources.requests}'

When everything is in place, the HPA says so explicitly, and the wording confirms that the percentage is computed on the request:

Output
ScalingActive True ValidMetricFound
the HPA was able to successfully calculate a replica count from cpu resource
utilization (percentage of request)

The HPA is stuck at 1 replica

Here the metrics come in correctly, and the HPA has simply decided to do nothing. Check these three explanations before suspecting a malfunction:

  1. The load is too close to the target: the deviation stays within the tolerance (10% by default, that is between 45% and 55% for a 50% target).
  2. minReplicas: 1 prevents going lower.
  3. ScalingLimited: True: maxReplicas is reached.

A kubectl scale is undone within seconds

Once an HPA is placed on a Deployment, it owns the replicas field. A manual kubectl scale succeeds, but the HPA rewrites the value at its next evaluation. Measured on a --min=2 --max=5 HPA at rest: a scale to 4 replicas is brought back to 2 within 15 seconds, and a scale to 1, below the minimum, is raised back to 2 in the same delay.

Terminal window
kubectl scale deployment/web --replicas=4
kubectl describe hpa web
Output (excerpt)
deployment.apps/web scaled
...
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal SuccessfulRescale 46s horizontal-pod-autoscaler New size: 2; reason: All metrics below target

The 5-minute stabilization window does not protect your value: it keeps the highest HPA recommendation over that period, and the HPA had been recommending 2 from the start. Your 4 was never a recommendation, so it is undone right away.

The right reflex depends on what you are after. To move the range, change minReplicas or maxReplicas of the HPA with kubectl patch. To take control back durably, delete the HPA and then scale: the two drivers do not coexist.

The HPA flaps

The load varies around the threshold and causes repeated scale-ups and scale-downs. Increase the stabilization window to smooth these variations:

behavior:
scaleDown:
stabilizationWindowSeconds: 600
scaleUp:
stabilizationWindowSeconds: 60

Put it into practice

A HorizontalPodAutoscaler that has never resized anything is not a validated HPA. This lab has you set up the autoscaler, generate load, watch the replicas scale up and then cut the load, and the validation reads the rescale event emitted by the controller.

Key takeaways

  1. The HPA adjusts the number of replicas, not the size of the Pods, which is the VPA's job.
  2. requests are mandatory for averageUtilization: without them, TARGETS stays at cpu: <unknown>/50%.
  3. Metrics Server (v0.9.1, metrics.k8s.io/v1beta1 API only) is required for CPU and memory.
  4. The formula is current replicas × (utilization / target), rounded up, with a 10% tolerance that can be set per HPA in 1.37.
  5. Scale-down is deliberately slow: 5 minutes of stabilization by default.
  6. behavior sets the scaling speed and the tolerance, on both the scaleUp and scaleDown sides.
  7. kubectl autoscale --cpu=50% creates an autoscaling/v2 HPA without behavior; once in place, the HPA owns replicas and undoes any kubectl scale.
  8. kubectl describe hpa tells the causes of an empty TARGETS apart: pods.metrics.k8s.io for a missing Metrics Server, missing request for cpu for missing requests. The first messages after creation (unable to handle the request, no metrics returned) come from the first collection and point to neither of these two causes.
  9. HPAScaleToZero is Beta and enabled by default in 1.37; it requires an Object or External metric, and KEDA provides the adapters.

Knowledge check

This short quiz covers the key points of the lesson: the role of requests, reading the conditions and the difference between scaling up and scaling down.

Knowledge check

Check what you have learned with this interactive quiz

7 questions
5 min
80% to pass

How it works

  • The timer starts when you click Start
  • Multiple choice, true/false and short answer questions
  • You can move between questions
  • Detailed results are shown at the end

Starts the quiz and the timer