Terraform module to deploy an aks cluster at azure
This module creates an aks cluster and a service pricipal
dedicated to its resources, a virtual network and subnet needs to be previously created. There is also the option to create a storage account
of the MC resource group, to be used as persistence.
- Creating a cluster containing usage nodepool
location = "eastus2"
resource_group = "rg-my-cluster"
aks_name = "my-cluster"
admin_username = "my-user"
node_count = 1
auto_scaling_default_node = false
node_min_count = null
node_max_count = null
default_node_vm_size = "Standard_DS2_v2"
additional_node_pools = {
"pooltest" = {
vm_size = "Standard_DS2_v2"
os_disk_size_gb = 100
enable_auto_scaling = false
availability_zones = []
node_count = 1
min_count = null
max_count = null
max_pods = 110
node_labels = null
taints = null
}
}
No requirements.
Name | Version |
---|---|
azuread | n/a |
azurerm | n/a |
local | n/a |
null | n/a |
random | n/a |
tls | n/a |
No modules.
Name | Type |
---|---|
azuread_application.sp | resource |
azuread_service_principal.sp | resource |
azuread_service_principal_password.sp | resource |
azurerm_kubernetes_cluster.k8s | resource |
azurerm_kubernetes_cluster_node_pool.aks | resource |
azurerm_role_assignment.role_assignment_aks | resource |
azurerm_role_assignment.role_assignment_network | resource |
azurerm_storage_account.st | resource |
local_file.kubeconfig_file | resource |
null_resource.delay_after_sp_created | resource |
random_string.unique | resource |
tls_private_key.pair | resource |
azurerm_subnet.subnet | data source |
Name | Description | Type | Default | Required |
---|---|---|---|---|
additional_node_pools | (Optional) List of additional node pools to the cluster | map(object({ |
{} |
no |
admin_username | (Required) The Admin Username for the Cluster. Changing this forces a new resource to be created. | string |
n/a | yes |
auto_scaling_default_node | (Optional) Kubernetes Auto Scaler must be enabled for this main pool | bool |
n/a | yes |
availability_zones | (Optional) A list of Availability Zones across which the Node Pool should be spread. Changing this forces a new resource to be created. | list(string) |
[] |
no |
dns_service_ip | (Optional) IP address within the Kubernetes service address range that will be used by cluster service discovery (kube-dns). | string |
"10.0.0.10" |
no |
docker_bridge_cidr | (Optional) The Network Range used by the Kubernetes service. Changing this forces a new resource to be created. | string |
"172.17.0.1/16" |
no |
end_date | The End Date which the Password is valid until, formatted as a RFC3339 date string (e.g. 2018-01-01T01:02:03Z). | string |
"2030-01-01T00:00:00Z" |
no |
k8s_version | (Optional) Version of Kubernetes specified when creating the AKS managed cluster. If not specified, the latest recommended version will be used at provisioning time (but won't auto-upgrade). | string |
"1.23.5" |
no |
location | (Required) Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created. | string |
n/a | yes |
max_pods | (Optional) The maximum number of pods that can run on each agent. Changing this forces a new resource to be created. | number |
110 |
no |
netwok_resource_group | (Required) Name of the resource group that contains the virtual network | string |
n/a | yes |
network_subnet | (Required) Network subnet name. | string |
n/a | yes |
network_vnet | (Required) Virtual network name. | string |
n/a | yes |
node_count | (Optional) The initial number of nodes which should exist in this Node Pool. If specified this must be between 1 and 100 and between min_count and max_count. | string |
n/a | yes |
node_max_count | (Required) The maximum number of nodes which should exist in this Node Pool. If specified this must be between 1 and 100. | number |
n/a | yes |
node_min_count | (Required) The minimum number of nodes which should exist in this Node Pool. If specified this must be between 1 and 100. | number |
n/a | yes |
pod_cidr | (Optional) The CIDR to use for pod IP addresses. Changing this forces a new resource to be created. | string |
"10.244.0.0/16" |
no |
prefix | (Required) Base name used by resources (cluster name, main service and others). | string |
n/a | yes |
rbac_enabled | (Required) Is Role Based Access Control Enabled? Changing this forces a new resource to be created. | bool |
false |
no |
resource_group | (Required) Specifies the Resource Group where the Managed Kubernetes Cluster should exist. Changing this forces a new resource to be created. | string |
n/a | yes |
service_cidr | (Optional) The Network Range used by the Kubernetes service.Changing this forces a new resource to be created. | string |
"10.0.0.0/16" |
no |
sku_tier | (Optional) Defines the SLA plan for the availability of system. Valid options are Free or Paid, paid option enables the Uptime SLA feature (see https://docs.microsoft.com/en-us/azure/aks/uptime-sla for more info) | string |
"Free" |
no |
storage_account_kind | (Optional) Defines the Kind of account. Valid options are BlobStorage, BlockBlobStorage, FileStorage, Storage and StorageV2. Changing this forces a new resource to be created. Defaults to StorageV2. | string |
"FileStorage" |
no |
storage_account_name | (Optional) Data storage name (use lower case, no spaces and special characters ex: mystorageaccount).null empty does not create resource. | string |
n/a | yes |
storage_account_replication_type | (Required) Defines the type of replication to use for this storage account. Valid options are LRS, GRS, RAGRS and ZRS. | string |
"LRS" |
no |
storage_account_tier | (Required) Defines the Tier to use for this storage account. Valid options are Standard and Premium. For FileStorage accounts only Premium is valid. Changing this forces a new resource to be created. | string |
"Premium" |
no |
tags | (Optional) A mapping of tags to assign to the resource. | map(string) |
n/a | yes |
vm_size | (Required) The size of the Virtual Machine, such as Standard_DS2_v2. | string |
"Standard_DS2_v2" |
no |
Name | Description |
---|---|
cluster_name | Cluster name to be used in the context of kubectl |
config | Commands to configure kubectl local |
kube_config_file | Kubeconfig file |
kube_config_raw | Client configuration file for connecting to the cluster |
service_principal_id | Service Principal ID |
service_principal_secret | Service Principal Secrets |