Configure Horizontal Pod AutoScaler (HPA)

Deploy the Metrics Server

Metrics Server is a cluster-wide aggregator of resource usage data. These metrics will drive the scaling behavior of the deployments. We will deploy the metrics server using Helm configured in a previous module

# create the metrics-service namespace first
kubectl create namespace metrics

helm install metrics-server \
    stable/metrics-server \
    --version 2.9.0 \
    --namespace metrics

Confirm the Metrics API is available.

Return to the terminal in the Cloud9 Environment

kubectl get apiservice v1beta1.metrics.k8s.io -o yaml

If all is well, you should see a status message similar to the one below in the response


status:
  conditions:
  - lastTransitionTime: "2020-02-18T21:33:26Z"
    message: all checks passed
    reason: Passed
    status: "True"
    type: Available

We are now ready to scale a deployed application