Autoscale on CPU and fix an unknown target

  • 12 min
  • 5 steps
  • Operate and ship

Steps

0 of 5 done

web runs one replica under steady load and api already has an HPA that reports . Put web under an HPA, predict and watch where it settles, find why api's HPA cannot compute anything, fix it, and slow down web's scale-down.

  1. Step 1 of 5

    Create an HPA for the web Deployment that aims for 50% average CPU utilization, with at least 2 and at most 10 replicas.

    Checked against the cluster as it changes.

  2. Step 2, not started: web's single pod uses about 400m against a 100m request. Work out the replica count the HPA should settle on, then watch the HPA until it gets there.

  3. Step 3, not started: The api HPA has shown <unknown> since it was created. Find the message the controller gives for it.

  4. Step 4, not started: Give api's container a CPU request of 100m without hand-editing YAML, so its HPA can compute utilization.

  5. Step 5, not started: When web's load drops, it should lose at most one pod per minute. Add a scale-down policy to its HPA that allows that and nothing faster.

Lab terminal

Cluster time 1 minute
kind cluster kx, Kubernetes 1.37.
Each step is checked as you work.
​
Tab completes. Up and Down recall.
Type help for more.
Terminal keys

Enter runs the command. Tab completes, and the arrow keys recall earlier commands. Control C stops a watch. On an empty line, or after Escape, Tab moves focus out of the terminal.