Terraform module for deploy Cluster Autoscaler for AWS EKS to your kubernetes cluster.
This module creates all necessary resources for deploy AWS Cluster Autoscale inside your kubernetes cluster. It helps you to manage your EKS cluster node size (as EC2 Auto Scaling Group) based on internal kubernetes metrics.
module "cluster_autoscaler" {
source = "../"
aws_region = "us-west-1"
cluster_name = "my-EKS-cluster-name"
// Optional
resources = {
request_cpu = "150m"
request_memory = "70Mi"
}
}
Please add next aws tags to your Auto Scaling Group
k8s.io/cluster-autoscaler/enabled = true
k8s.io/cluster-autoscaler/CLUSTER_NAME = true
You can add additional Cluster Autoscaler container arguments via additional_deployment_commands
. See all possible args in official Cluster Autoscaler docs:
additional_deployment_commands = [
"--balance-similar-node-groups=true",
"--skip-nodes-with-local-storage=false"
]
NOTE: If you want to use other metrics, please set 'service_monitor_enable' to true and set namespace where your monitoring system deployed:
service_monitor_enable = true
metrics_namespace = "monitoring-prometheus"
Name | Description | Type | Default | Example | Required |
---|---|---|---|---|---|
cloud_provider | Cloud Provier name (support only 'aws') | string |
aws |
n/a | no |
aws_region | Region where EKS deployed | string |
n/a | us-east-1 |
yes |
aws_role_arn | AWS role for Cluster Autoscaler | string |
null |
arn:aws:iam::123456789:role/eks-oidc-cluster-autoscaler |
no |
app_name | Name of Cluster Autoscaler | string |
cluster-autoscaler |
n/a | no |
namespace | Name of kubernetes namespace for cluster autoscaler | string |
cluster-autoscaler |
n/a | no |
create_namespace | Create namespace by module ? true or false | bool |
true |
n/a | no |
cluster_name | EKS cluster name | string |
n/a | my-EKS-cluste-name |
yes |
node_selector | Choose node where you want to deploy Cluster Autoscaler | map(string) |
null |
{ |
no |
service_monitor_enable | Enable Service Monitor? If true set variable 'metrics_namespace' | bool |
false |
n/a | no |
metrics_namespace | Namespace where metrics collector (such as Prometheus) is deployed | string |
null |
monitoring |
no |
prometheus_release_label | Prometheus release label ( typically name of helm chart ) | string |
kube-prometheus-stack |
kube-prometheus-stack |
no |
rbac_psp_enable | Enable Pod Security Policies (PSP) | bool |
false |
n/a | no |
docker_image | Image for cluster autoscaler | string |
k8s.gcr.io/autoscaling/cluster-autoscaler:v1.21.1 |
n/a | no |
additional_deployment_commands | Your additional args to Cluster Autoscaler deployment | list(string) |
[] |
[ |
no |
service_ports | Ports for auth request from ingress to service | list(object({ |
[ |
n/a | no |
resources | Your Cluster Autoscaler deployment limits | map(string) |
{ |
n/a | no |
Name | Description |
---|---|
name | Name of Cluster Autoscaler |
namespace | Name of namespace where Cluster Autoscaler deployed |
service_account_name | Name of Cluster Autoscaler service account |
Name | Description |
---|---|
Terraform | >= 0.14.9 |
Kubernetes provider | >= 2.6.1 |