169163334 - Adds autoscaling to k8s
This adds node autoscaling the k8s. Pod autoscaling needs to be configured in the kubectl config.
This commit is contained in:
parent
3c1a199cee
commit
5eeb5f976a
@ -21,6 +21,9 @@ resource "azurerm_kubernetes_cluster" "k8s" {
|
|||||||
vnet_subnet_id = var.vnet_subnet_id
|
vnet_subnet_id = var.vnet_subnet_id
|
||||||
node_count = 1
|
node_count = 1
|
||||||
enable_node_public_ip = true # Nodes need a public IP for external resources. FIXME: Switch to NAT Gateway if its available in our subscription
|
enable_node_public_ip = true # Nodes need a public IP for external resources. FIXME: Switch to NAT Gateway if its available in our subscription
|
||||||
|
enable_auto_scaling = var.enable_auto_scaling
|
||||||
|
max_count = var.max_count # FIXME: if auto_scaling disabled, set to 0
|
||||||
|
min_count = var.min_count # FIXME: if auto_scaling disabled, set to 0
|
||||||
}
|
}
|
||||||
|
|
||||||
lifecycle {
|
lifecycle {
|
||||||
|
@ -33,3 +33,22 @@ variable "vnet_subnet_id" {
|
|||||||
description = "Subnet to use for the default k8s pool"
|
description = "Subnet to use for the default k8s pool"
|
||||||
type = string
|
type = string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
variable "enable_auto_scaling" {
|
||||||
|
default = false
|
||||||
|
type = string
|
||||||
|
description = "Enable or disable autoscaling (Default: false)"
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "max_count" {
|
||||||
|
default = 1
|
||||||
|
type = string
|
||||||
|
description = "Maximum number of nodes to use in autoscaling. This requires `enable_auto_scaling` to be set to true"
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "min_count" {
|
||||||
|
default = 1
|
||||||
|
type = string
|
||||||
|
description = "Minimum number of nodes to use in autoscaling. This requires `enable_auto_scaling` to be set to true"
|
||||||
|
}
|
||||||
|
@ -7,6 +7,9 @@ module "k8s" {
|
|||||||
k8s_dns_prefix = var.k8s_dns_prefix
|
k8s_dns_prefix = var.k8s_dns_prefix
|
||||||
k8s_node_size = var.k8s_node_size
|
k8s_node_size = var.k8s_node_size
|
||||||
vnet_subnet_id = module.vpc.subnets #FIXME - output from module.vpc.subnets should be map
|
vnet_subnet_id = module.vpc.subnets #FIXME - output from module.vpc.subnets should be map
|
||||||
|
enable_auto_scaling = true
|
||||||
|
max_count = 5
|
||||||
|
min_count = 2
|
||||||
}
|
}
|
||||||
|
|
||||||
#module "main_lb" {
|
#module "main_lb" {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user