Skip to content

Latest commit

 

History

History
75 lines (55 loc) · 1.35 KB

2-autoscaling.md

File metadata and controls

75 lines (55 loc) · 1.35 KB

Auto-scaling guide

HPA

Deploy Frontend and Backend services

Create a release named frontend:

helm upgrade --install --wait frontend \
    --set replicaCount=2 \
    --set service.type=NodePort \
    --set service.nodePort=30098 \
    --namespace test \
    sp/podinfo

Setup horizontal pod auto-scaling (HPA) based on memory consumption:

helm upgrade --reuse-values frontend \
    --set hpa.enabled=true \
    --set hpa.maxReplicas=5 \
    --set hpa.memory=200Mi \
    sp/podinfo

Create a release named backend:

helm upgrade --install --wait backend \
    --set replicaCount=1 \
    --set service.type=ClusterIP \
    --namespace test \
    sp/podinfo

Setup HPA based on CPU usage:

helm upgrade --reuse-values backend \
    --set hpa.enabled=true \
    --set hpa.maxReplicas=10 \
    --set hpa.cpu=10 \
    sp/podinfo

Check if the backend ClusterIP service is accessible from within the cluster:

helm test --cleanup backend

Wait for HPA to start receiving metrics:

kubectl -n test get hpa

Run load test:

#install hey
go get -u github.com/rakyll/hey

#do 10K requests rate limited at 100 QPS
hey -n 1000 -q 10 -c 10 -m POST -d "testing" http://<EXTERNAL-IP>:30098/backend

Delete the releases:

helm delete --purge frontend backend