What is the Kubernetes Vertical Pod Autoscaler (VPA)?
The Kubernetes Vertical Pod Autoscaler (VPA) frees the user from the necessity of setting up-to-date resource limits and requests for the containers in their pods. When configured, it will set the requests automatically based on usage and thus allow proper scheduling onto nodes so that appropriate resource amount is available for each pod. It will also maintain ratios between limits and requests that were specified in initial containers configuration.
NOTE: This Kubernetes feature is still in beta and as such should not be used in production.
How do you create a Vertical Pod Autoscaler on AWS using Terraform?
Pending the time this feature is supported natively on the AWS and/or Terraform Kubernetes providers, here’s how to deploy it on Amazon Elastic Kubernetes Service (EKS) using Terraform:
Pre-requisites
Before creating the Vertical Pod Autoscaler, you need the following:
- An existing EKS cluster. You can deploy that via the
aws_eks_cluster
resource here. - A Kubernetes Metrics Server installed. Here’s a tutorial
- A
kubectl
(Kubernetes command-line) client configured to communicate with your EKS cluster. Tutorial here.
Deploy the Vertical Pod Autoscaler (VPA) on AWS EKS
After you have the pre-requisites setup, all that’s left is to deploy the VPA, and you can do that on EKS by following the Amazon guide here: https://docs.aws.amazon.com/eks/latest/userguide/vertical-pod-autoscaler.html
Additional Notes
- For Horizontal Pod Autoscaling (HPA), see the Terraform
kubernetes_horizontal_pod_autoscaler
resource here. - For more information on managing Kubernetes resources using Terraform, see here.
- More about the
kubectl
tool here. - Google has its own version of the VPA via the Google Kubernetes Engine (GKE) service. Also in Beta. You can deploy it using Terraform via the
google_container_cluster
here.