Skip to content

Instantly share code, notes, and snippets.

@arun-gupta
Last active December 17, 2018 16:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save arun-gupta/781b51958c2cbda560aec36fdf4a4052 to your computer and use it in GitHub Desktop.
Save arun-gupta/781b51958c2cbda560aec36fdf4a4052 to your computer and use it in GitHub Desktop.
Getting Started with HPA on EKS
  • Create an EKS cluster: eksctl create cluster --name myeks --nodes 4 --region us-west-2
  • Install Metrics Server
    kubectl apply -f https://raw.githubusercontent.com/kubernetes-incubator/metrics-server/master/deploy/1.8%2B/auth-delegator.yaml
    kubectl apply -f https://raw.githubusercontent.com/kubernetes-incubator/metrics-server/master/deploy/1.8%2B/auth-reader.yaml
    kubectl apply -f https://raw.githubusercontent.com/kubernetes-incubator/metrics-server/master/deploy/1.8%2B/metrics-apiservice.yaml
    kubectl apply -f https://raw.githubusercontent.com/kubernetes-incubator/metrics-server/master/deploy/1.8%2B/metrics-server-deployment.yaml
    kubectl apply -f https://raw.githubusercontent.com/kubernetes-incubator/metrics-server/master/deploy/1.8%2B/metrics-server-service.yaml
    kubectl apply -f https://raw.githubusercontent.com/kubernetes-incubator/metrics-server/master/deploy/1.8%2B/resource-reader.yaml
    
  • Create a deployment and service:
    $ kubectl run php-apache --image=k8s.gcr.io/hpa-example --requests=cpu=200m --expose --port=80
    service/php-apache created
    deployment.apps/php-apache created
    
  • Create HPA:
    $ kubectl autoscale deployment php-apache --cpu-percent=50 --min=1 --max=10
    horizontalpodautoscaler.autoscaling/php-apache autoscaled
    

Optional

  • Upgrade AWS CLI: pip install awscli --upgrade --user
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment