Azure Container Kubernetes Cluster
This page shows how to write Terraform and Azure Resource Manager for Container Kubernetes Cluster and write them securely.
azurerm_kubernetes_cluster (Terraform)
The Kubernetes Cluster in Container can be configured in Terraform with the resource name azurerm_kubernetes_cluster. The following sections describe 10 examples of how to use the resource and its parameters.
Example Usage from GitHub
resource "azurerm_kubernetes_cluster" "free_D2V2" {
name = "example-aks1"
location = "eastus"
resource_group_name = azurerm_resource_group.example.name
dns_prefix = "exampleaks1"
resource "azurerm_kubernetes_cluster" "positive1" {
name = "example-aks1"
location = azurerm_resource_group.example.location
resource_group_name = azurerm_resource_group.example.name
dns_prefix = "exampleaks1"
resource "azurerm_kubernetes_cluster" "example" {
provisioner "local-exec" {
command = "sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
resource "azurerm_kubernetes_cluster" "positive1" {
name = "example-aks1"
location = azurerm_resource_group.example.location
resource_group_name = azurerm_resource_group.example.name
dns_prefix = "exampleaks1"
resource "azurerm_kubernetes_cluster" "denied" {}
resource "azurerm_kubernetes_cluster" "denied_2" {
api_server_authorized_ip_ranges = ["0.0.0.0/0"]
}
resource "azurerm_kubernetes_cluster" "allowed_2" {}
resource "azurerm_kubernetes_cluster" "allowed" {
role_based_access_control {
enabled = true
}
resource "azurerm_kubernetes_cluster" "denied" {}
resource "azurerm_kubernetes_cluster" "denied_2" {
addon_profile {
oms_agent {
enabled = false
resource "azurerm_kubernetes_cluster" "negative1" {
name = "example-aks1"
location = azurerm_resource_group.example.location
resource_group_name = azurerm_resource_group.example.name
dns_prefix = "exampleaks1"
resource "azurerm_kubernetes_cluster" "negative1" {
name = "example-aks1"
location = azurerm_resource_group.example.location
resource_group_name = azurerm_resource_group.example.name
dns_prefix = "exampleaks1"
resource "azurerm_kubernetes_cluster" "positive1" {
name = "example-aks1"
location = azurerm_resource_group.example.location
resource_group_name = azurerm_resource_group.example.name
dns_prefix = "exampleaks1"
Security Best Practices for azurerm_kubernetes_cluster
There are 4 settings in azurerm_kubernetes_cluster that should be taken care of for security reasons. The following section explain an overview and example code.
Ensure to enable logging for AKS
It is better to enable AKS logging to Azure Monitoring. This provides useful information regarding access and usage.
Ensure to configure a network policy
It is better to configure NetworkPolicy to control traffic to pods. In the default settings, there are no restrictions and a pod can find and communicate with any other pods.
Ensure to enable RBAC on AKS clusters
It is better to enable role-based access control (RBAC) on AKS clusters. This provides you to grant users, groups, and service accounts access to only the required resources.
Ensure to limit the access to an AKS API server to a limited IP range
It is better to limit the access to the AKS API server in an AKS control plane to a limited IP range to mitigate unexpected attacks.
Parameters
-
api_server_authorized_ip_rangesoptional - set of string -
automatic_channel_upgradeoptional - string -
disk_encryption_set_idoptional - string -
dns_prefixrequired - string -
enable_pod_security_policyoptional - bool -
fqdnoptional computed - string -
idoptional computed - string -
kube_admin_configoptional computed - list of object-
client_certificate- string -
client_key- string -
cluster_ca_certificate- string -
host- string -
password- string -
username- string
-
-
kube_admin_config_rawoptional computed - string -
kube_configoptional computed - list of object-
client_certificate- string -
client_key- string -
cluster_ca_certificate- string -
host- string -
password- string -
username- string
-
-
kube_config_rawoptional computed - string -
kubelet_identityoptional computed - list of object-
client_id- string -
object_id- string -
user_assigned_identity_id- string
-
-
kubernetes_versionoptional computed - string -
locationrequired - string -
namerequired - string -
node_resource_groupoptional computed - string -
private_cluster_enabledoptional computed - bool -
private_dns_zone_idoptional computed - string -
private_fqdnoptional computed - string -
private_link_enabledoptional computed - bool -
resource_group_namerequired - string -
sku_tieroptional - string -
tagsoptional - map from string to string -
addon_profilelist block-
aci_connector_linuxlist block-
enabledrequired - bool -
subnet_nameoptional - string
-
-
azure_policylist block-
enabledrequired - bool
-
-
http_application_routinglist block-
enabledrequired - bool -
http_application_routing_zone_nameoptional computed - string
-
-
kube_dashboardlist block-
enabledrequired - bool
-
-
oms_agentlist block-
enabledrequired - bool -
log_analytics_workspace_idoptional - string -
oms_agent_identityoptional computed - list of object-
client_id- string -
object_id- string -
user_assigned_identity_id- string
-
-
-
-
auto_scaler_profilelist block-
balance_similar_node_groupsoptional - bool -
expanderoptional computed - string -
max_graceful_termination_secoptional computed - string -
new_pod_scale_up_delayoptional computed - string -
scale_down_delay_after_addoptional computed - string -
scale_down_delay_after_deleteoptional computed - string -
scale_down_delay_after_failureoptional computed - string -
scale_down_unneededoptional computed - string -
scale_down_unreadyoptional computed - string -
scale_down_utilization_thresholdoptional computed - string -
scan_intervaloptional computed - string -
skip_nodes_with_local_storageoptional - bool -
skip_nodes_with_system_podsoptional - bool
-
-
default_node_poollist block-
availability_zonesoptional - list of string -
enable_auto_scalingoptional - bool -
enable_host_encryptionoptional - bool -
enable_node_public_ipoptional - bool -
max_countoptional - number -
max_podsoptional computed - number -
min_countoptional - number -
namerequired - string -
node_countoptional computed - number -
node_labelsoptional - map from string to string -
node_taintsoptional - list of string -
only_critical_addons_enabledoptional - bool -
orchestrator_versionoptional computed - string -
os_disk_size_gboptional computed - number -
os_disk_typeoptional - string -
proximity_placement_group_idoptional - string -
tagsoptional - map from string to string -
typeoptional - string -
vm_sizerequired - string -
vnet_subnet_idoptional - string -
upgrade_settingslist block-
max_surgerequired - string
-
-
-
identitylist block-
principal_idoptional computed - string -
tenant_idoptional computed - string -
typerequired - string -
user_assigned_identity_idoptional - string
-
-
linux_profilelist block-
admin_usernamerequired - string -
ssh_keylist block-
key_datarequired - string
-
-
-
network_profilelist block-
dns_service_ipoptional computed - string -
docker_bridge_cidroptional computed - string -
load_balancer_skuoptional - string -
network_modeoptional computed - string -
network_pluginrequired - string -
network_policyoptional computed - string -
outbound_typeoptional - string -
pod_cidroptional computed - string -
service_cidroptional computed - string -
load_balancer_profilelist block-
effective_outbound_ipsoptional computed - set of string -
idle_timeout_in_minutesoptional - number -
managed_outbound_ip_countoptional computed - number -
outbound_ip_address_idsoptional computed - set of string -
outbound_ip_prefix_idsoptional computed - set of string -
outbound_ports_allocatedoptional - number
-
-
-
role_based_access_controllist block-
enabledrequired - bool -
azure_active_directorylist block-
admin_group_object_idsoptional - set of string -
client_app_idoptional - string -
managedoptional - bool -
server_app_idoptional - string -
server_app_secretoptional - string -
tenant_idoptional computed - string
-
-
-
service_principallist block-
client_idrequired - string -
client_secretrequired - string
-
-
timeoutssingle block -
windows_profilelist block-
admin_passwordoptional - string -
admin_usernamerequired - string
-
Explanation in Terraform Registry
Manages a Managed Kubernetes Cluster (also known as AKS / Azure Kubernetes Service) -> Note: Due to the fast-moving nature of AKS, we recommend using the latest version of the Azure Provider when using AKS - you can find the latest version of the Azure Provider here.
Note: All arguments including the client secret will be stored in the raw state as plain-text. Read more about sensitive data in state.
Microsoft.ContainerService/managedClusters (Azure Resource Manager)
The managedClusters in Microsoft.ContainerService can be configured in Azure Resource Manager with the resource name Microsoft.ContainerService/managedClusters. The following sections describe how to use the resource and its parameters.
Example Usage from GitHub
"type": "Microsoft.ContainerService/managedClusters",
"apiVersion": "[variables('apiVersionManangedClusters')]",
"name": "[variables('clusterName')]",
"location": "[parameters('location')]",
"dependsOn": [
"[resourceId('Microsoft.Network/virtualNetworks', variables('vnetName'))]",
"type": "Microsoft.ContainerService/managedClusters",
"apiVersion": "2021-02-01",
"name": "[variables('clusterName')]",
"location": "[parameters('location')]",
"tags": {
"Application identifier": "[variables('appId')]"
"type": "Microsoft.ContainerService/managedClusters",
"apiVersion": "2020-11-01",
"name": "[variables('clusterName')]",
"location": "[parameters('location')]",
"dependsOn": [
"[resourceId('Microsoft.OperationsManagement/solutions', variables('containerInsightsSolutionName'))]"
"type": "Microsoft.ContainerService/managedClusters",
"apiVersion": "2021-02-01",
"name": "[variables('clusterName')]",
"location": "[parameters('location')]",
"dependsOn": [
"[resourceId('Microsoft.OperationsManagement/solutions', variables('containerInsightsSolutionName'))]",
"type": "Microsoft.ContainerService/managedClusters",
"apiVersion": "2020-11-01",
"name": "[variables('clusterName')]",
"location": "[parameters('location')]",
"dependsOn": [
"[resourceId('Microsoft.OperationsManagement/solutions', variables('containerInsightsSolutionName'))]"
"type": "Microsoft.ContainerService/managedClusters",
"apiVersion": "2021-02-01",
"name": "[variables('clusterName')]",
"location": "[parameters('location')]",
"tags": {
"Business unit": "BU0001",
"type": "Microsoft.ContainerService/managedClusters",
"apiVersion": "2021-02-01",
"name": "[variables('clusterName')]",
"location": "[parameters('location')]",
"dependsOn": [
"[resourceId('Microsoft.OperationsManagement/solutions', variables('containerInsightsSolutionName'))]",
"type": "Microsoft.ContainerService/managedClusters",
"apiVersion": "2021-02-01",
"name": "[variables('clusterName')]",
"location": "[parameters('location')]",
"dependsOn": [
"[resourceId('Microsoft.OperationsManagement/solutions', variables('containerInsightsSolutionName'))]",
"type": "Microsoft.ContainerService/managedClusters",
"apiVersion": "2021-02-01",
"name": "[variables('clusterName')]",
"location": "[parameters('location')]",
"dependsOn": [
"[resourceId('Microsoft.OperationsManagement/solutions', variables('containerInsightsSolutionName'))]",
"type": "Microsoft.ContainerService/managedClusters",
"apiVersion": "2021-02-01",
"name": "[variables('clusterName')]",
"location": "[parameters('location')]",
"tags": {
"Business unit": "BU0001",
Parameters
apiVersionrequired - stringextendedLocationoptionalnameoptional - stringThe name of the extended location.
typeoptional - stringThe type of the extended location.
identityoptionaltypeoptional - stringFor more information see use managed identities in AKS.
userAssignedIdentitiesoptional - undefinedThe keys must be ARM resource IDs in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'.
locationrequired - stringResource location
namerequired - stringThe name of the managed cluster resource.
propertiesrequiredaadProfileoptionaladminGroupObjectIDsoptional - arrayThe list of AAD group object IDs that will have admin role of the cluster.
clientAppIDoptional - stringThe client AAD application ID.
enableAzureRBACoptional - booleanWhether to enable Azure RBAC for Kubernetes authorization.
managedoptional - booleanWhether to enable managed AAD.
serverAppIDoptional - stringThe server AAD application ID.
serverAppSecretoptional - stringThe server AAD application secret.
tenantIDoptional - stringThe AAD tenant ID to use for authentication. If not specified, will use the tenant of the deployment subscription.
addonProfilesoptional - undefinedThe profile of managed cluster add-on.
agentPoolProfilesoptional arrayavailabilityZonesoptional - arrayThe list of Availability zones to use for nodes. This can only be specified if the AgentPoolType property is 'VirtualMachineScaleSets'.
countoptional - integerNumber of agents (VMs) to host docker containers. Allowed values must be in the range of 0 to 1000 (inclusive) for user pools and in the range of 1 to 1000 (inclusive) for system pools. The default value is 1.
creationDataoptionalsourceResourceIdoptional - stringThis is the ARM ID of the source object to be used to create the target object.
enableAutoScalingoptional - booleanWhether to enable auto-scaler
enableEncryptionAtHostoptional - booleanThis is only supported on certain VM sizes and in certain Azure regions. For more information, see: https://docs.microsoft.com/azure/aks/enable-host-encryption
enableFIPSoptional - booleanSee Add a FIPS-enabled node pool for more details.
enableNodePublicIPoptional - booleanSome scenarios may require nodes in a node pool to receive their own dedicated public IP addresses. A common scenario is for gaming workloads, where a console needs to make a direct connection to a cloud virtual machine to minimize hops. For more information see assigning a public IP per node. The default is false.
enableUltraSSDoptional - booleanWhether to enable UltraSSD
gpuInstanceProfileoptional - stringGPUInstanceProfile to be used to specify GPU MIG instance profile for supported GPU VM SKU.
kubeletConfigoptionalallowedUnsafeSysctlsoptional - arrayAllowed list of unsafe sysctls or unsafe sysctl patterns (ending in
*).containerLogMaxFilesoptional - integerThe maximum number of container log files that can be present for a container. The number must be ≥ 2.
containerLogMaxSizeMBoptional - integerThe maximum size (e.g. 10Mi) of container log file before it is rotated.
cpuCfsQuotaoptional - booleanThe default is true.
cpuCfsQuotaPeriodoptional - stringThe default is '100ms.' Valid values are a sequence of decimal numbers with an optional fraction and a unit suffix. For example: '300ms', '2h45m'. Supported units are 'ns', 'us', 'ms', 's', 'm', and 'h'.
cpuManagerPolicyoptional - stringThe default is 'none'. See Kubernetes CPU management policies for more information. Allowed values are 'none' and 'static'.
failSwapOnoptional - booleanIf set to true it will make the Kubelet fail to start if swap is enabled on the node.
imageGcHighThresholdoptional - integerTo disable image garbage collection, set to 100. The default is 85%
imageGcLowThresholdoptional - integerThis cannot be set higher than imageGcHighThreshold. The default is 80%
podMaxPidsoptional - integerThe maximum number of processes per pod.
topologyManagerPolicyoptional - stringFor more information see Kubernetes Topology Manager. The default is 'none'. Allowed values are 'none', 'best-effort', 'restricted', and 'single-numa-node'.
kubeletDiskTypeoptional - stringlinuxOSConfigoptionalswapFileSizeMBoptional - integerThe size in MB of a swap file that will be created on each node.
sysctlsoptionalfsAioMaxNroptional - integerSysctl setting fs.aio-max-nr.
fsFileMaxoptional - integerSysctl setting fs.file-max.
fsInotifyMaxUserWatchesoptional - integerSysctl setting fs.inotify.max_user_watches.
fsNrOpenoptional - integerSysctl setting fs.nr_open.
kernelThreadsMaxoptional - integerSysctl setting kernel.threads-max.
netCoreNetdevMaxBacklogoptional - integerSysctl setting net.core.netdev_max_backlog.
netCoreOptmemMaxoptional - integerSysctl setting net.core.optmem_max.
netCoreRmemDefaultoptional - integerSysctl setting net.core.rmem_default.
netCoreRmemMaxoptional - integerSysctl setting net.core.rmem_max.
netCoreSomaxconnoptional - integerSysctl setting net.core.somaxconn.
netCoreWmemDefaultoptional - integerSysctl setting net.core.wmem_default.
netCoreWmemMaxoptional - integerSysctl setting net.core.wmem_max.
netIpv4IpLocalPortRangeoptional - stringSysctl setting net.ipv4.ip_local_port_range.
netIpv4NeighDefaultGcThresh1optional - integerSysctl setting net.ipv4.neigh.default.gc_thresh1.
netIpv4NeighDefaultGcThresh2optional - integerSysctl setting net.ipv4.neigh.default.gc_thresh2.
netIpv4NeighDefaultGcThresh3optional - integerSysctl setting net.ipv4.neigh.default.gc_thresh3.
netIpv4TcpFinTimeoutoptional - integerSysctl setting net.ipv4.tcp_fin_timeout.
netIpv4TcpkeepaliveIntvloptional - integerSysctl setting net.ipv4.tcp_keepalive_intvl.
netIpv4TcpKeepaliveProbesoptional - integerSysctl setting net.ipv4.tcp_keepalive_probes.
netIpv4TcpKeepaliveTimeoptional - integerSysctl setting net.ipv4.tcp_keepalive_time.
netIpv4TcpMaxSynBacklogoptional - integerSysctl setting net.ipv4.tcp_max_syn_backlog.
netIpv4TcpMaxTwBucketsoptional - integerSysctl setting net.ipv4.tcp_max_tw_buckets.
netIpv4TcpTwReuseoptional - booleanSysctl setting net.ipv4.tcp_tw_reuse.
netNetfilterNfConntrackBucketsoptional - integerSysctl setting net.netfilter.nf_conntrack_buckets.
netNetfilterNfConntrackMaxoptional - integerSysctl setting net.netfilter.nf_conntrack_max.
vmMaxMapCountoptional - integerSysctl setting vm.max_map_count.
vmSwappinessoptional - integerSysctl setting vm.swappiness.
vmVfsCachePressureoptional - integerSysctl setting vm.vfs_cache_pressure.
transparentHugePageDefragoptional - stringValid values are 'always', 'defer', 'defer+madvise', 'madvise' and 'never'. The default is 'madvise'. For more information see Transparent Hugepages.
transparentHugePageEnabledoptional - stringValid values are 'always', 'madvise', and 'never'. The default is 'always'. For more information see Transparent Hugepages.
maxCountoptional - integerThe maximum number of nodes for auto-scaling
maxPodsoptional - integerThe maximum number of pods that can run on a node.
minCountoptional - integerThe minimum number of nodes for auto-scaling
modeoptional - stringnamerequired - stringWindows agent pool names must be 6 characters or less.
nodeLabelsoptional - stringThe node labels to be persisted across all nodes in agent pool.
nodePublicIPPrefixIDoptional - stringThis is of the form: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}
nodeTaintsoptional - arrayThe taints added to new nodes during node pool create and scale. For example, key=value:NoSchedule.
orchestratorVersionoptional - stringAs a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version as the control plane. The node pool minor version must be within two minor versions of the control plane version. The node pool version cannot be greater than the control plane version. For more information see upgrading a node pool.
osDiskSizeGBoptional - integerOS Disk Size in GB to be used to specify the disk size for every machine in the master/agent pool. If you specify 0, it will apply the default osDisk size according to the vmSize specified.
osDiskTypeoptional - stringosSKUoptional - stringosTypeoptional - stringpodSubnetIDoptional - stringIf omitted, pod IPs are statically assigned on the node subnet (see vnetSubnetID for more details). This is of the form: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}
powerStateoptionalcodeoptional - stringTells whether the cluster is Running or Stopped.
proximityPlacementGroupIDoptional - stringThe ID for Proximity Placement Group.
scaleDownModeoptional - stringThis also effects the cluster autoscaler behavior. If not specified, it defaults to Delete.
scaleSetEvictionPolicyoptional - stringThis cannot be specified unless the scaleSetPriority is 'Spot'. If not specified, the default is 'Delete'.
scaleSetPriorityoptional - stringThe Virtual Machine Scale Set priority. If not specified, the default is 'Regular'.
spotMaxPriceoptional - numberPossible values are any decimal value greater than zero or -1 which indicates the willingness to pay any on-demand price. For more details on spot pricing, see spot VMs pricing
tagsoptional - stringThe tags to be persisted on the agent pool virtual machine scale set.
typeoptional - stringupgradeSettingsoptionalmaxSurgeoptional - stringThis can either be set to an integer (e.g. '5') or a percentage (e.g. '50%'). If a percentage is specified, it is the percentage of the total agent pool size at the time of the upgrade. For percentages, fractional nodes are rounded up. If not specified, the default is 1. For more information, including best practices, see: https://docs.microsoft.com/azure/aks/upgrade-cluster#customize-node-surge-upgrade
vmSizeoptional - stringVM size availability varies by region. If a node contains insufficient compute resources (memory, cpu, etc) pods might fail to run correctly. For more details on restricted VM sizes, see: https://docs.microsoft.com/azure/aks/quotas-skus-regions
vnetSubnetIDoptional - stringIf this is not specified, a VNET and subnet will be generated and used. If no podSubnetID is specified, this applies to nodes and pods, otherwise it applies to just nodes. This is of the form: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}
workloadRuntimeoptional - string
apiServerAccessProfileoptionalauthorizedIPRangesoptional - arrayIP ranges are specified in CIDR format, e.g. 137.117.106.88/29. This feature is not compatible with clusters that use Public IP Per Node, or clusters that are using a Basic Load Balancer. For more information see API server authorized IP ranges.
disableRunCommandoptional - booleanWhether to disable run command for the cluster or not.
enablePrivateClusteroptional - booleanFor more details, see Creating a private AKS cluster.
enablePrivateClusterPublicFQDNoptional - booleanWhether to create additional public FQDN for private cluster or not.
privateDNSZoneoptional - stringThe default is System. For more details see configure private DNS zone. Allowed values are 'system' and 'none'.
autoScalerProfileoptionalbalance-similar-node-groupsoptional - stringValid values are 'true' and 'false'
expanderoptional - stringIf not specified, the default is 'random'. See expanders for more information.
max-empty-bulk-deleteoptional - stringThe default is 10.
max-graceful-termination-secoptional - stringThe default is 600.
max-node-provision-timeoptional - stringThe default is '15m'. Values must be an integer followed by an 'm'. No unit of time other than minutes (m) is supported.
max-total-unready-percentageoptional - stringThe default is 45. The maximum is 100 and the minimum is 0.
new-pod-scale-up-delayoptional - stringFor scenarios like burst/batch scale where you don't want CA to act before the kubernetes scheduler could schedule all the pods, you can tell CA to ignore unscheduled pods before they're a certain age. The default is '0s'. Values must be an integer followed by a unit ('s' for seconds, 'm' for minutes, 'h' for hours, etc).
ok-total-unready-countoptional - stringThis must be an integer. The default is 3.
scale-down-delay-after-addoptional - stringThe default is '10m'. Values must be an integer followed by an 'm'. No unit of time other than minutes (m) is supported.
scale-down-delay-after-deleteoptional - stringThe default is the scan-interval. Values must be an integer followed by an 'm'. No unit of time other than minutes (m) is supported.
scale-down-delay-after-failureoptional - stringThe default is '3m'. Values must be an integer followed by an 'm'. No unit of time other than minutes (m) is supported.
scale-down-unneeded-timeoptional - stringThe default is '10m'. Values must be an integer followed by an 'm'. No unit of time other than minutes (m) is supported.
scale-down-unready-timeoptional - stringThe default is '20m'. Values must be an integer followed by an 'm'. No unit of time other than minutes (m) is supported.
scale-down-utilization-thresholdoptional - stringThe default is '0.5'.
scan-intervaloptional - stringThe default is '10'. Values must be an integer number of seconds.
skip-nodes-with-local-storageoptional - stringThe default is true.
skip-nodes-with-system-podsoptional - stringThe default is true.
autoUpgradeProfileoptionalupgradeChanneloptional - stringFor more information see setting the AKS cluster auto-upgrade channel.
disableLocalAccountsoptional - booleanIf set to true, getting static credentials will be disabled for this cluster. This must only be used on Managed Clusters that are AAD enabled. For more details see disable local accounts.
diskEncryptionSetIDoptional - stringThis is of the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{encryptionSetName}'
dnsPrefixoptional - stringThis cannot be updated once the Managed Cluster has been created.
enablePodSecurityPolicyoptional - boolean(DEPRECATING) Whether to enable Kubernetes pod security policy (preview). This feature is set for removal on October 15th, 2020. Learn more at aka.ms/aks/azpodpolicy.
enableRBACoptional - booleanWhether to enable Kubernetes Role-Based Access Control.
fqdnSubdomainoptional - stringThis cannot be updated once the Managed Cluster has been created.
httpProxyConfigoptionalhttpProxyoptional - stringThe HTTP proxy server endpoint to use.
httpsProxyoptional - stringThe HTTPS proxy server endpoint to use.
noProxyoptional - arrayThe endpoints that should not go through proxy.
trustedCaoptional - stringAlternative CA cert to use for connecting to proxy servers.
identityProfileoptional - undefinedIdentities associated with the cluster.
kubernetesVersionoptional - stringWhen you upgrade a supported AKS cluster, Kubernetes minor versions cannot be skipped. All upgrades must be performed sequentially by major version number. For example, upgrades between 1.14.x -> 1.15.x or 1.15.x -> 1.16.x are allowed, however 1.14.x -> 1.16.x is not allowed. See upgrading an AKS cluster for more details.
linuxProfileoptionaladminUsernamerequired - stringThe administrator username to use for Linux VMs.
sshrequiredpublicKeysrequired arraykeyDatarequired - stringCertificate public key used to authenticate with VMs through SSH. The certificate must be in PEM format with or without headers.
networkProfileoptionaldnsServiceIPoptional - stringAn IP address assigned to the Kubernetes DNS service. It must be within the Kubernetes service address range specified in serviceCidr.
dockerBridgeCidroptional - stringA CIDR notation IP range assigned to the Docker bridge network. It must not overlap with any Subnet IP ranges or the Kubernetes service address range.
ipFamiliesoptional - arrayIP families are used to determine single-stack or dual-stack clusters. For single-stack, the expected value is IPv4. For dual-stack, the expected values are IPv4 and IPv6.
loadBalancerProfileoptionalallocatedOutboundPortsoptional - integerThe desired number of allocated SNAT ports per VM. Allowed values are in the range of 0 to 64000 (inclusive). The default value is 0 which results in Azure dynamically allocating ports.
effectiveOutboundIPsoptional arrayidoptional - stringThe fully qualified Azure resource id.
enableMultipleStandardLoadBalancersoptional - booleanEnable multiple standard load balancers per AKS cluster or not.
idleTimeoutInMinutesoptional - integerDesired outbound flow idle timeout in minutes. Allowed values are in the range of 4 to 120 (inclusive). The default value is 30 minutes.
managedOutboundIPsoptionalcountoptional - integerThe desired number of IPv4 outbound IPs created/managed by Azure for the cluster load balancer. Allowed values must be in the range of 1 to 100 (inclusive). The default value is 1.
countIPv6optional - integerThe desired number of IPv6 outbound IPs created/managed by Azure for the cluster load balancer. Allowed values must be in the range of 1 to 100 (inclusive). The default value is 0 for single-stack and 1 for dual-stack.
outboundIPPrefixesoptionalpublicIPPrefixesoptional arrayidoptional - stringThe fully qualified Azure resource id.
outboundIPsoptionalpublicIPsoptional arrayidoptional - stringThe fully qualified Azure resource id.
loadBalancerSkuoptional - stringThe default is 'standard'. See Azure Load Balancer SKUs for more information about the differences between load balancer SKUs.
natGatewayProfileoptionaleffectiveOutboundIPsoptional arrayidoptional - stringThe fully qualified Azure resource id.
idleTimeoutInMinutesoptional - integerDesired outbound flow idle timeout in minutes. Allowed values are in the range of 4 to 120 (inclusive). The default value is 4 minutes.
managedOutboundIPProfileoptionalcountoptional - integerThe desired number of outbound IPs created/managed by Azure. Allowed values must be in the range of 1 to 16 (inclusive). The default value is 1.
networkModeoptional - stringThis cannot be specified if networkPlugin is anything other than 'azure'.
networkPluginoptional - stringNetwork plugin used for building the Kubernetes network.
networkPolicyoptional - stringNetwork policy used for building the Kubernetes network.
outboundTypeoptional - stringThis can only be set at cluster creation time and cannot be changed later. For more information see egress outbound type.
podCidroptional - stringA CIDR notation IP range from which to assign pod IPs when kubenet is used.
podCidrsoptional - arrayOne IPv4 CIDR is expected for single-stack networking. Two CIDRs, one for each IP family (IPv4/IPv6), is expected for dual-stack networking.
serviceCidroptional - stringA CIDR notation IP range from which to assign service cluster IPs. It must not overlap with any Subnet IP ranges.
serviceCidrsoptional - arrayOne IPv4 CIDR is expected for single-stack networking. Two CIDRs, one for each IP family (IPv4/IPv6), is expected for dual-stack networking. They must not overlap with any Subnet IP ranges.
nodeResourceGroupoptional - stringThe name of the resource group containing agent pool nodes.
podIdentityProfileoptionalallowNetworkPluginKubenetoptional - booleanRunning in Kubenet is disabled by default due to the security related nature of AAD Pod Identity and the risks of IP spoofing. See using Kubenet network plugin with AAD Pod Identity for more information.
enabledoptional - booleanWhether the pod identity addon is enabled.
userAssignedIdentitiesoptional arraybindingSelectoroptional - stringThe binding selector to use for the AzureIdentityBinding resource.
identityrequiredclientIdoptional - stringThe client ID of the user assigned identity.
objectIdoptional - stringThe object ID of the user assigned identity.
resourceIdoptional - stringThe resource ID of the user assigned identity.
namerequired - stringThe name of the pod identity.
namespacerequired - stringThe namespace of the pod identity.
userAssignedIdentityExceptionsoptional arraynamerequired - stringThe name of the pod identity exception.
namespacerequired - stringThe namespace of the pod identity exception.
podLabelsrequired - stringThe pod labels to match.
privateLinkResourcesoptional arraygroupIdoptional - stringThe group ID of the resource.
idoptional - stringThe ID of the private link resource.
nameoptional - stringThe name of the private link resource.
requiredMembersoptional - arrayThe RequiredMembers of the resource
typeoptional - stringThe resource type.
publicNetworkAccessoptional - stringAllow or deny public network access for AKS.
securityProfileoptionalazureDefenderoptionalenabledoptional - booleanWhether to enable Azure Defender
logAnalyticsWorkspaceResourceIdoptional - stringResource ID of the Log Analytics workspace to be associated with Azure Defender. When Azure Defender is enabled, this field is required and must be a valid workspace resource ID. When Azure Defender is disabled, leave the field empty.
servicePrincipalProfileoptionalclientIdrequired - stringThe ID for the service principal.
secretoptional - stringThe secret password associated with the service principal in plain text.
windowsProfileoptionaladminPasswordoptional - stringSpecifies the password of the administrator account. Minimum-length: 8 characters Max-length: 123 characters Complexity requirements: 3 out of 4 conditions below need to be fulfilled Has lower characters Has upper characters Has a digit Has a special character (Regex match [\W_]) Disallowed values: "abc@123", "P@$$w0rd", "P@ssw0rd", "P@ssword123", "Pa$$word", "pass@word1", "Password!", "Password1", "Password22", "iloveyou!"
adminUsernamerequired - stringSpecifies the name of the administrator account. Restriction: Cannot end in "." Disallowed values: "administrator", "admin", "user", "user1", "test", "user2", "test1", "user3", "admin1", "1", "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", "david", "guest", "john", "owner", "root", "server", "sql", "support", "support_388945a0", "sys", "test2", "test3", "user4", "user5". Minimum-length: 1 character Max-length: 20 characters
enableCSIProxyoptional - booleanFor more details on CSI proxy, see the CSI proxy GitHub repo.
gmsaProfileoptionaldnsServeroptional - stringSpecifies the DNS server for Windows gMSA. Set it to empty if you have configured the DNS server in the vnet which is used to create the managed cluster.
enabledoptional - booleanSpecifies whether to enable Windows gMSA in the managed cluster.
rootDomainNameoptional - stringSpecifies the root domain name for Windows gMSA. Set it to empty if you have configured the DNS server in the vnet which is used to create the managed cluster.
licenseTypeoptional - stringThe license type to use for Windows VMs. See Azure Hybrid User Benefits for more details.
skuoptionalnameoptional - stringThe name of a managed cluster SKU.
tieroptional - stringIf not specified, the default is 'Free'. See uptime SLA for more details.
tagsoptional - stringResource tags
typerequired - string
Frequently asked questions
What is Azure Container Kubernetes Cluster?
Azure Container Kubernetes Cluster is a resource for Container of Microsoft Azure. Settings can be wrote in Terraform.
Where can I find the example code for the Azure Container Kubernetes Cluster?
For Terraform, the gilyas/infracost, leonidweinbergcx/mykics and Totix82/TerraformToAzureAKSIncludingDockerNginxAndHelm source code examples are useful. See the Terraform Example section for further details.
For Azure Resource Manager, the ConsenSys/quorum-kubernetes, mspnp/aks-baseline-multi-region and dsanchor/aks-generic source code examples are useful. See the Azure Resource Manager Example section for further details.