|
| 1 | +# Azure Kubernetes Services |
| 2 | + |
| 3 | +## Introduction |
| 4 | + |
| 5 | +This module manages a Azure Kubernetes Services cluser. Besides the cluster itself it manages a defined amount of outbound IPs |
| 6 | + |
| 7 | +## Usage |
| 8 | + |
| 9 | +Instantiate the module by calling it from Terraform like this: |
| 10 | + |
| 11 | +```hcl |
| 12 | +module "azure-k8s" { |
| 13 | + source = "dodevops/kubernetes/azure" |
| 14 | + version = "<version>" |
| 15 | +} |
| 16 | +``` |
| 17 | + |
| 18 | +<!-- BEGIN_TF_DOCS --> |
| 19 | +# General notes |
| 20 | + |
| 21 | +When using more than one node pool, the load balancer sku "Basic" is not supported. It needs to be at least "Standard", see |
| 22 | +https://docs.microsoft.com/azure/aks/use-multiple-node-pools |
| 23 | + |
| 24 | +All "System" mode pools must be able to reach all pods/subnets |
| 25 | + |
| 26 | +## Requirements |
| 27 | + |
| 28 | +No requirements. |
| 29 | + |
| 30 | +## Providers |
| 31 | + |
| 32 | +The following providers are used by this module: |
| 33 | + |
| 34 | +- azurerm |
| 35 | + |
| 36 | +## Modules |
| 37 | + |
| 38 | +No modules. |
| 39 | + |
| 40 | +## Resources |
| 41 | + |
| 42 | +The following resources are used by this module: |
| 43 | + |
| 44 | +- [azurerm_kubernetes_cluster.k8s](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/kubernetes_cluster) (resource) |
| 45 | +- [azurerm_kubernetes_cluster_node_pool.additional](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/kubernetes_cluster_node_pool) (resource) |
| 46 | +- [azurerm_public_ip.public-ip-outbound](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/public_ip) (resource) |
| 47 | + |
| 48 | +## Required Inputs |
| 49 | + |
| 50 | +The following input variables are required: |
| 51 | + |
| 52 | +### client\_id |
| 53 | + |
| 54 | +Description: Azure client ID to use to manage Azure resources from the cluster, like f.e. load balancers |
| 55 | + |
| 56 | +Type: `string` |
| 57 | + |
| 58 | +### client\_secret |
| 59 | + |
| 60 | +Description: Azure client secret to use to manage Azure resources from the cluster, like f.e. load balancers |
| 61 | + |
| 62 | +Type: `string` |
| 63 | + |
| 64 | +### default\_node\_pool\_k8s\_version |
| 65 | + |
| 66 | +Description: Version of kubernetes for the default node pool |
| 67 | + |
| 68 | +Type: `string` |
| 69 | + |
| 70 | +### kubernetes\_version |
| 71 | + |
| 72 | +Description: Version of kubernetes of the control plane |
| 73 | + |
| 74 | +Type: `string` |
| 75 | + |
| 76 | +### location |
| 77 | + |
| 78 | +Description: Azure location to use |
| 79 | + |
| 80 | +Type: `string` |
| 81 | + |
| 82 | +### node\_count |
| 83 | + |
| 84 | +Description: Number of Kubernetes cluster nodes to use |
| 85 | + |
| 86 | +Type: `string` |
| 87 | + |
| 88 | +### project |
| 89 | + |
| 90 | +Description: Three letter project key |
| 91 | + |
| 92 | +Type: `string` |
| 93 | + |
| 94 | +### resource\_group |
| 95 | + |
| 96 | +Description: Azure Resource Group to use |
| 97 | + |
| 98 | +Type: `string` |
| 99 | + |
| 100 | +### ssh\_public\_key |
| 101 | + |
| 102 | +Description: SSH public key to access the kubernetes node with |
| 103 | + |
| 104 | +Type: `string` |
| 105 | + |
| 106 | +### stage |
| 107 | + |
| 108 | +Description: Stage for this ip |
| 109 | + |
| 110 | +Type: `string` |
| 111 | + |
| 112 | +### subnet\_id |
| 113 | + |
| 114 | +Description: ID of subnet to host the nodes, pods and services in. |
| 115 | + |
| 116 | +Type: `string` |
| 117 | + |
| 118 | +### vm\_size |
| 119 | + |
| 120 | +Description: Type of vm to use. Use az vm list-sizes --location <location> to list all available sizes |
| 121 | + |
| 122 | +Type: `string` |
| 123 | + |
| 124 | +## Optional Inputs |
| 125 | + |
| 126 | +The following input variables are optional (have default values): |
| 127 | + |
| 128 | +### availability\_zones |
| 129 | + |
| 130 | +Description: availability zones to spread the cluster nodes across, if omitted, only one avilability zone is used |
| 131 | + |
| 132 | +Type: `list(number)` |
| 133 | + |
| 134 | +Default: `[]` |
| 135 | + |
| 136 | +### default\_node\_pool\_name |
| 137 | + |
| 138 | +Description: Name of the default node pool |
| 139 | + |
| 140 | +Type: `string` |
| 141 | + |
| 142 | +Default: `"default"` |
| 143 | + |
| 144 | +### dns\_prefix |
| 145 | + |
| 146 | +Description: DNS-Prefix to use. Defaults to cluster name |
| 147 | + |
| 148 | +Type: `string` |
| 149 | + |
| 150 | +Default: `"NONE"` |
| 151 | + |
| 152 | +### idle\_timeout |
| 153 | + |
| 154 | +Description: Desired outbound flow idle timeout in minutes for the cluster load balancer. Must be between 4 and 120 inclusive. |
| 155 | + |
| 156 | +Type: `number` |
| 157 | + |
| 158 | +Default: `5` |
| 159 | + |
| 160 | +### load\_balancer\_sku |
| 161 | + |
| 162 | +Description: The SKU for the used Load Balancer |
| 163 | + |
| 164 | +Type: `string` |
| 165 | + |
| 166 | +Default: `"Basic"` |
| 167 | + |
| 168 | +### max\_pods |
| 169 | + |
| 170 | +Description: Amount of pods allowed on each node (be aware that kubernetes system pods are also counted |
| 171 | + |
| 172 | +Type: `string` |
| 173 | + |
| 174 | +Default: `"30"` |
| 175 | + |
| 176 | +### network\_policy |
| 177 | + |
| 178 | +Description: Network policy to use, currently only azure and callico are supported |
| 179 | + |
| 180 | +Type: `string` |
| 181 | + |
| 182 | +Default: `"azure"` |
| 183 | + |
| 184 | +### node\_pools |
| 185 | + |
| 186 | +Description: Additional node pools to set up |
| 187 | + |
| 188 | +Type: |
| 189 | + |
| 190 | +```hcl |
| 191 | +map(object({ |
| 192 | + vm_size : string, |
| 193 | + count : number, |
| 194 | + os_disk_size_gb : number, |
| 195 | + k8s_version : string, |
| 196 | + node_labels : map(string), |
| 197 | + max_pods : number, |
| 198 | + mode : string, |
| 199 | + taints : list(string), |
| 200 | + availability_zones : list(number) |
| 201 | + })) |
| 202 | +``` |
| 203 | + |
| 204 | +Default: `{}` |
| 205 | + |
| 206 | +### node\_storage |
| 207 | + |
| 208 | +Description: Disk size in GB |
| 209 | + |
| 210 | +Type: `string` |
| 211 | + |
| 212 | +Default: `"30"` |
| 213 | + |
| 214 | +### outbound\_ports\_allocated |
| 215 | + |
| 216 | +Description: Pre-allocated ports (AKS default: 0) |
| 217 | + |
| 218 | +Type: `number` |
| 219 | + |
| 220 | +Default: `0` |
| 221 | + |
| 222 | +### rbac\_enabled |
| 223 | + |
| 224 | +Description: Enables RBAC on the cluster. If true, rbac\_managed\_admin\_groups have to be specified. |
| 225 | + |
| 226 | +Type: `bool` |
| 227 | + |
| 228 | +Default: `false` |
| 229 | + |
| 230 | +### rbac\_managed\_admin\_groups |
| 231 | + |
| 232 | +Description: The group IDs that have admin access to the cluster. Have to be specified if rbac\_enabled is true |
| 233 | + |
| 234 | +Type: `list(string)` |
| 235 | + |
| 236 | +Default: `[]` |
| 237 | + |
| 238 | +### sku\_tier |
| 239 | + |
| 240 | +Description: n/a |
| 241 | + |
| 242 | +Type: `string` |
| 243 | + |
| 244 | +Default: `"Free"` |
| 245 | + |
| 246 | +### static\_outbound\_ip\_count |
| 247 | + |
| 248 | +Description: On a lot of outgoing connections use this together with the maximum for outbound\_ports\_allocated of 64000 to not fall into network |
| 249 | + bottlenecks. Recommended in that case is to set the count at least +5 more than the count of kubernetes nodes. |
| 250 | + |
| 251 | +Type: `number` |
| 252 | + |
| 253 | +Default: `1` |
| 254 | + |
| 255 | +## Outputs |
| 256 | + |
| 257 | +The following outputs are exported: |
| 258 | + |
| 259 | +### client\_certificate |
| 260 | + |
| 261 | +Description: n/a |
| 262 | + |
| 263 | +### client\_certificate\_admin |
| 264 | + |
| 265 | +Description: n/a |
| 266 | + |
| 267 | +### client\_key |
| 268 | + |
| 269 | +Description: n/a |
| 270 | + |
| 271 | +### client\_key\_admin |
| 272 | + |
| 273 | +Description: n/a |
| 274 | + |
| 275 | +### client\_token |
| 276 | + |
| 277 | +Description: n/a |
| 278 | + |
| 279 | +### client\_token\_admin |
| 280 | + |
| 281 | +Description: n/a |
| 282 | + |
| 283 | +### cluster\_ca\_certificate |
| 284 | + |
| 285 | +Description: n/a |
| 286 | + |
| 287 | +### cluster\_id |
| 288 | + |
| 289 | +Description: n/a |
| 290 | + |
| 291 | +### cluster\_name |
| 292 | + |
| 293 | +Description: n/a |
| 294 | + |
| 295 | +### fqdn |
| 296 | + |
| 297 | +Description: n/a |
| 298 | + |
| 299 | +### host |
| 300 | + |
| 301 | +Description: n/a |
| 302 | + |
| 303 | +### node\_resource\_group |
| 304 | + |
| 305 | +Description: n/a |
| 306 | +<!-- END_TF_DOCS --> |
0 commit comments