Skip to content

deepakttn/terraform-azure-aks

 
 

Repository files navigation

Terraform-Azure-AKS

Lint Status LICENSE

Terraform module to deploy an aks cluster at azure The following content needed to be created and managed:

Introduction Explaination of files Intended users Resource created and managed by this code Example Usages

Example usage

  • Creating a cluster containing usage nodepool
location = "eastus2"
resource_group = "Resource_group"
prefix = "new_kubernetes"
node_count = 1
auto_scaling_default_node = false
node_min_count = null
node_max_count = null
default_node_vm_size = "Standard_DS2_v2"
create_additional_node_pool = false 

if "enable_auto_scaling" is "true" then pass values in "min_count" and "max_count".
if "create_additional_node_pool" is "true" only then "additional_node_pool" will get created.

additional_node_pools = {
  "pool1" = {
	vm_size = "Standard_DS2_v2"
    os_disk_size_gb = 100
	enable_auto_scaling = false 
    availability_zones  = ["1", "2", "3"]
    node_count          = 1
    min_count           = null
    max_count           = null
    max_pods            = 110
    node_labels         = {}
    taints              = []
  }
}

Requirements

Name Version
terraform >= 1.3.0
azure >= 3.0
kubernetes >= 1.22.11

Providers

Name Version
azuread n/a
azurerm n/a
local n/a
null n/a

Modules

No modules.

Resources

Name Type
azurerm_resource_group.rg resource
azurerm_kubernetes_cluster.cluster resource
azurerm_kubernetes_cluster_node_pool.aks resource
local_file.kubeconfig resource
azurerm_virtual_network.vnet resource
azurerm_subnet.subnet resource

Inputs

Name Description Type Default Required
create_additional_node_pool (Optional) Use for condition if we want to create additional_node_pool bool n/a yes
additional_node_pools (Optional) List of additional node pools to the cluster
map(object({
vm_size = string
os_disk_size_gb = number
enable_auto_scaling = bool
availability_zones = list(string)
node_count = number
min_count = number
max_count = number
max_pods = number
node_labels = map(string)
taints = list(string)
}))
{} no
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
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
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
network_plugin (Required) It defines the networking solution used to handle network communication between containers running within a Kubernetes cluster. string 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
network_subnet (Required) Network subnet name. string n/a yes
network_vnet (Required) Virtual network name. string n/a yes
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
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

Outputs

Name Description
cluster_name Cluster name to be used in the context of kubectl
kube_config_file Kubeconfig file

Authors

Module managed by TO THE NEW Pvt. Ltd.

License

Apache 2 Licensed. See LICENSE for full details.

About

Create Azure Kubernetes Cluster

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • HCL 100.0%