Skip to content

Commit

Permalink
Update AKS logging to log fewer things, add flexibility in disk confi…
Browse files Browse the repository at this point in the history
…g for system pool (#94)
  • Loading branch information
lumberbaron authored Dec 16, 2024
1 parent 2696f91 commit c714a10
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 13 deletions.
3 changes: 3 additions & 0 deletions aks/terraform/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ module "cluster" {
outbound_ip_count = var.outbound_ip_count
outbound_ports_allocated = var.outbound_ports_allocated

worker_node_vm_size = local.system_vm_size
worker_node_ssh_public_key = var.worker_node_ssh_public_key

kubernetes_api_public_access = var.kubernetes_api_public_access
Expand All @@ -83,6 +84,8 @@ module "cluster" {
locals {
os_disk_size_gb = 48

system_vm_size = "Standard_D2s_v3"

prod1k_vm_size = "Standard_E2s_v3"
prod10k_vm_size = "Standard_E4s_v3"
prod100k_vm_size = "Standard_E8s_v3"
Expand Down
1 change: 1 addition & 0 deletions aks/terraform/modules/broker-node-pool/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ No modules.
| <a name="input_node_pool_taints"></a> [node\_pool\_taints](#input\_node\_pool\_taints) | Kubernetes taints added to worker nodes in the node pools. | `list(string)` | n/a | yes |
| <a name="input_subnet_id"></a> [subnet\_id](#input\_subnet\_id) | The subnet that will contain the worker nodes in each node pool. | `string` | n/a | yes |
| <a name="input_worker_node_disk_size"></a> [worker\_node\_disk\_size](#input\_worker\_node\_disk\_size) | The OS disk size (in GB) used for the worker nodes in each node pool. | `string` | n/a | yes |
| <a name="input_worker_node_disk_type"></a> [worker\_node\_disk\_type](#input\_worker\_node\_disk\_type) | The type of the OS disk for the worker nodes in each node pool. | `string` | `"Ephemeral"` | no |
| <a name="input_worker_node_vm_size"></a> [worker\_node\_vm\_size](#input\_worker\_node\_vm\_size) | The VM size used for the worker nodes in each node pool. | `string` | n/a | yes |

## Outputs
Expand Down
2 changes: 1 addition & 1 deletion aks/terraform/modules/broker-node-pool/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ resource "azurerm_kubernetes_cluster_node_pool" "this" {
vnet_subnet_id = var.subnet_id

vm_size = var.worker_node_vm_size
os_disk_type = "Ephemeral"
os_disk_type = var.worker_node_disk_type
os_disk_size_gb = var.worker_node_disk_size

node_labels = var.node_pool_labels
Expand Down
6 changes: 6 additions & 0 deletions aks/terraform/modules/broker-node-pool/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@ variable "worker_node_disk_size" {
description = "The OS disk size (in GB) used for the worker nodes in each node pool."
}

variable "worker_node_disk_type" {
type = string
default = "Ephemeral"
description = "The type of the OS disk for the worker nodes in each node pool."
}

variable "node_pool_labels" {
type = map(string)
description = "Kubernetes labels added to worker nodes in the node pools."
Expand Down
3 changes: 3 additions & 0 deletions aks/terraform/modules/cluster/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,10 @@ No modules.
| <a name="input_resource_group_name"></a> [resource\_group\_name](#input\_resource\_group\_name) | The name of the resource group that will contain the cluster. | `string` | n/a | yes |
| <a name="input_route_table_id"></a> [route\_table\_id](#input\_route\_table\_id) | The ID of the route table of the subnet where the cluster will reside. | `string` | n/a | yes |
| <a name="input_subnet_id"></a> [subnet\_id](#input\_subnet\_id) | The ID of the subnet where the cluster will reside. | `string` | n/a | yes |
| <a name="input_worker_node_os_disk_size_gb"></a> [worker\_node\_os\_disk\_size\_gb](#input\_worker\_node\_os\_disk\_size\_gb) | The size of the OS disk for the worker nodes in the default (system) node pool. | `number` | `48` | no |
| <a name="input_worker_node_os_disk_type"></a> [worker\_node\_os\_disk\_type](#input\_worker\_node\_os\_disk\_type) | The type of the OS disk for the worker nodes in the default (system) node pool. | `string` | `"Ephemeral"` | no |
| <a name="input_worker_node_ssh_public_key"></a> [worker\_node\_ssh\_public\_key](#input\_worker\_node\_ssh\_public\_key) | The public key that will be added to the authorized keys file on the worker nodes for SSH access. | `string` | n/a | yes |
| <a name="input_worker_node_vm_size"></a> [worker\_node\_vm\_size](#input\_worker\_node\_vm\_size) | The default VM size for the worker nodes in the default (system) node pool. | `string` | n/a | yes |

## Outputs

Expand Down
18 changes: 6 additions & 12 deletions aks/terraform/modules/cluster/main.tf
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
locals {
worker_node_username = "worker"

os_disk_size_gb = 48
default_vm_size = "Standard_D2s_v3"
}

################################################################################
Expand Down Expand Up @@ -62,9 +59,9 @@ resource "azurerm_kubernetes_cluster" "cluster" {
default_node_pool {
name = "default"
node_count = 2
vm_size = local.default_vm_size
os_disk_size_gb = local.os_disk_size_gb
os_disk_type = "Ephemeral"
vm_size = var.worker_node_vm_size
os_disk_size_gb = var.worker_node_os_disk_size_gb
os_disk_type = var.worker_node_os_disk_type
vnet_subnet_id = var.subnet_id
zones = var.availability_zones
max_pods = var.max_pods_per_node
Expand Down Expand Up @@ -156,15 +153,12 @@ resource "azurerm_monitor_diagnostic_setting" "cluster" {
category = "cluster-autoscaler"
}

enabled_log {
category = "kube-apiserver"
}

enabled_log {
category = "kube-audit-admin"
}

enabled_log {
category = "kube-controller-manager"
metric {
category = "AllMetrics"
enabled = false
}
}
17 changes: 17 additions & 0 deletions aks/terraform/modules/cluster/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -109,4 +109,21 @@ variable "max_pods_per_node" {
type = number
default = 110
description = "The maximum number of pods for the worker nodes in the node pools."
}

variable "worker_node_vm_size" {
type = string
description = "The default VM size for the worker nodes in the default (system) node pool."
}

variable "worker_node_os_disk_size_gb" {
type = number
default = 48
description = "The size of the OS disk for the worker nodes in the default (system) node pool."
}

variable "worker_node_os_disk_type" {
type = string
default = "Ephemeral"
description = "The type of the OS disk for the worker nodes in the default (system) node pool."
}

0 comments on commit c714a10

Please sign in to comment.