{"id":12915,"date":"2019-10-27T16:32:17","date_gmt":"2019-10-27T15:32:17","guid":{"rendered":"https:\/\/www.dbi-services.com\/blog\/provisioning-a-aks-cluster-and-kubeinvaders-with-terraform-aks\/"},"modified":"2023-07-13T16:38:55","modified_gmt":"2023-07-13T14:38:55","slug":"provisioning-a-aks-cluster-and-kubeinvaders-with-terraform-aks","status":"publish","type":"post","link":"https:\/\/www.dbi-services.com\/blog\/provisioning-a-aks-cluster-and-kubeinvaders-with-terraform-aks\/","title":{"rendered":"Provisioning a AKS cluster and KubeInvaders with Terraform"},"content":{"rendered":"<p>Provisioning a K8s infrastructure may be performed in different ways. Terraform has a connector called the <a href=\"https:\/\/www.terraform.io\/docs\/providers\/kubernetes\/index.html\">Kubernetes provider<\/a> but it doesn\u2019t allow building and deploying a Kubernetes cluster. The cluster must be up and running before using the provider. Fortunately, there are different cloud-specific provider depending which cloud provider you want to provision your cluster.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-35021 size-full\" src=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/165-0-banner-e1572194322809.jpg\" alt=\"\" width=\"900\" height=\"268\" \/><\/p>\n<p>In our CI pipeline for the MSSQL DMK maintenance, we provision SQL Server containers on Linux to perform then different tests. Our K8s infrastructure is managed by Azure through AKS and the main issue we have so far is that the cluster must exist before deploying containers. In other hand, the period of testing is unpredictable and depends mainly on the team availability. The first approach was to leave the AKS cluster up and running all the time to avoid breaking the CI pipeline, but the main drawback is obviously the cost. One solution is to use Terraform provider for AKS through our DevOps Azure pipeline.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-35014\" src=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/165-1-CI-AKS.jpg\" alt=\"\" width=\"596\" height=\"362\" \/><\/p>\n<p>But in this blog let\u2019s start funny by provisioning the AKS infrastructure to host the <a href=\"https:\/\/github.com\/lucky-sideburn\/KubeInvaders\" target=\"_blank\" rel=\"noopener noreferrer\">KubeInvaders<\/a> project. KubeInvaders is a funny way to explain different components of K8s and I will use it during my next Workshop <a href=\"https:\/\/www.sqlsaturday.com\/926\/EventHome.aspx\" target=\"_blank\" rel=\"noopener noreferrer\">SQL Server on Kubernetes<\/a> at SQLSaturday Lisbon on November 29-30<sup>th<\/sup> 2019. In addition, deploying this project on AKS requires additional components including an Ingress controller, a cert manager and issuer to connect to KubeInvaders software from outside. In turn, those components are deployed through helm charts meaning we also must install helm and tiller (if you use helm version &lt; 3).<\/p>\n<p>Before sharing my code, let\u2019s say there is already a plenty of blogs that explains how to build a Terraform plan to deploy an AKS cluster and helm components. Therefore, I prefer to share my notes and issues I experienced during my work.<\/p>\n<p>1) In my context, I already manage an another AKS cluster from my laptop and I spent some times to understand the Kubernetes provider always first tries to load a config file from a given (or default) location as stated to the <a href=\"https:\/\/www.terraform.io\/docs\/providers\/kubernetes\/index.html\">Terraform documentation<\/a>. As a result, I experienced some weird behaviors when computing Terraform plan with detection of some components like service accounts that are supposed to not exist yet. In fact, the provider loaded my default config file ($HOME\/.kube\/config) was tied to another existing AKS cluster.<\/p>\n<p>2) I had to take care of module execution order to get a consistent result. Terraform module dependencies can be implicit or explicit (controlled by the depends_on clause).<\/p>\n<p>3) The \u201clocal-exec\u201d provisioner remains useful to do additional work that cannot be managed directly by a Terraform module. It was especially helpful to update some KubeInvaders files with the new fresh cluster connection info as well as the URL to reach KubeInvaders software.<\/p>\n<p>4) The tiller is installing only after deploying a first helm chart<\/p>\n<p>The components are deployed as follows:<\/p>\n<ul>\n<li>Create Azure AKS resource group<\/li>\n<li>Create AKS cluster<\/li>\n<li>Load Kubernetes provider with newly created AKS cluster credentials<\/li>\n<li>Create helm tiller service account<\/li>\n<li>Bind helm tiller service account with cluster-admin role (can be improved if production scenario)<\/li>\n<li>Save new cluster config into azure_config file for future connections from other CLI tools<\/li>\n<li>Create new namespaces for Ingress controller, cert manager and KubeInvaders<\/li>\n<li>Load helm provider with newly created AKS cluster credentials<\/li>\n<li>Deploy Ingress controller and configuration<\/li>\n<li>Deploy cert manager and cluster issuer and configuration<\/li>\n<li>Install KubeInvaders<\/li>\n<\/ul>\n<p>For the cert manager and cluster issuer, <span style=\"float: none; background-color: #ffffff; color: #333333; cursor: text; font-family: Georgia,'Times New Roman','Bitstream Charter',Times,serif; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none;\">in order to create an ingress controller with a static public address and TLS certificates<\/span>, I referred to the <a href=\"https:\/\/docs.microsoft.com\/bs-cyrl-ba\/azure\/aks\/ingress-static-ip\" target=\"_blank\" rel=\"noopener noreferrer\">Microsoft documentation<\/a> .<\/p>\n<p>For KuveInvaders, I just cloned the project in the same directory than my Terraform files and I used the deployment file for Kubernetes.<\/p>\n<p>Here my bash command file used to save my current kubeconfig file before running the Terraform stuff:<\/p>\n<pre class=\"brush: bash; gutter: true; first-line: 1\">#!\/bin\/bash\n\n# Remove all K8s contextes before applying terraform\nread -p \"Press [Enter] to save current K8s contextes ...\"\n\nexport KUBECONFIG=\n\nif [ -f \"$HOME\/.kube\/config\" ] \nthen \n    mv $HOME\/.kube\/config $HOME\/.kube\/config.sav\nfi\n\n# Generate terraform plan\nread -p \"Press [Enter] to generate plan ...\"\nterraform plan -out out.plan\n\n# Apply terraform plan\nread -p \"Press [Enter] to apply plan ...\"\nterraform apply out.plan\n\n# Restore saved K8s contextes\nread -p \"Press [Enter] to restore default K8s contextes ...\"\nif [ -f \"$HOME\/.kube\/config.sav\" ]; then mv $HOME\/.kube\/config.sav $HOME\/.kube\/config; fi\n\n# Load new context\nexport KUBECONFIG=.\/.kube\/azure_config<\/pre>\n<p>Here my Terraform files:<\/p>\n<ul>\n<li>\u00a0<strong>variables.tf<\/strong><\/li>\n<\/ul>\n<pre class=\"brush: xml; gutter: true; first-line: 1\">variable \"client_id\" {}\nvariable \"client_secret\" {}\n\nvariable \"agent_count\" {\n    default = 3\n}\n\nvariable \"ssh_public_key\" {\n    default = \"~\/.ssh\/id_rsa.pub\"\n}\n\nvariable \"dns_prefix\" {\n    default = \"aksci\"\n}\n\nvariable cluster_name {\n    default = \"aksci\"\n}\n\nvariable resource_group_name {\n    default = \"aks-grp\"\n}\n\nvariable location {\n    default = \"westeurope\"\n}\n\nvariable domain_name_label {\n    default = \"xxxx-ingress\"\n}\n\nvariable letsencrypt_email_address {\n    default = \"user@contoso.com\"\n}\n\nvariable letsencrypt_environment {\n    default = \"letsencrypt-staging\"\n}<\/pre>\n<ul>\n<li>\u00a0<strong>K8s_main.tf<\/strong><\/li>\n<\/ul>\n<pre class=\"brush: xml; gutter: true; first-line: 1\">###############################################\n#     Create Azure Resource Group for AKS     #\n###############################################   \nresource \"azurerm_resource_group\" \"aks-ci\" {\n    name     = \"${var.resource_group_name}\"\n    location = \"${var.location}\"\n\n    tags = {\n        Environment = \"CI\"\n    }\n}\n\n###############################################\n#             Create AKS cluster              #\n###############################################  \nresource \"azurerm_kubernetes_cluster\" \"aks-ci\" {\n\n    name                = \"${var.cluster_name}\"\n    location            = \"${azurerm_resource_group.aks-ci.location}\"\n    resource_group_name = \"${azurerm_resource_group.aks-ci.name}\"\n    dns_prefix          = \"${var.dns_prefix}\"\n    kubernetes_version  = \"1.14.6\"\n\n    role_based_access_control {\n        enabled = true\n    }\n\n    linux_profile {\n        admin_username = \"clustadmin\"\n\n        ssh_key {\n                key_data = \"${file(\"${var.ssh_public_key}\")}\"\n        }\n    }\n \n    agent_pool_profile {\n        name            = \"agentpool\"\n        count           = \"${var.agent_count}\"\n        vm_size         = \"Standard_DS2_v2\"\n        os_type         = \"Linux\"\n        os_disk_size_gb = 30\n    }\n\n    addon_profile {\n        kube_dashboard {\n            enabled = true\n        }\n    }\n \n    service_principal {\n        client_id     = \"${var.client_id}\"\n        client_secret = \"${var.client_secret}\"\n    }\n \n    tags = {\n        Environment = \"CI\"\n    }\n}\n\n###############################################\n#            Load Provider K8s                #\n###############################################  \n\nprovider \"kubernetes\" {\n    host                   = \"${azurerm_kubernetes_cluster.aks-ci.kube_config.0.host}\"\n    client_certificate     = \"${base64decode(azurerm_kubernetes_cluster.aks-ci.kube_config.0.client_certificate)}\"\n    client_key             = \"${base64decode(azurerm_kubernetes_cluster.aks-ci.kube_config.0.client_key)}\"\n    cluster_ca_certificate = \"${base64decode(azurerm_kubernetes_cluster.aks-ci.kube_config.0.cluster_ca_certificate)}\"\n    alias                  = \"aks-ci\"\n}\n\n###############################################\n#       Create tiller service account         #\n###############################################  \nresource \"kubernetes_service_account\" \"tiller\" {\n    provider = \"kubernetes.aks-ci\"\n    \n    metadata {\n        name      = \"tiller\"\n        namespace = \"kube-system\"\n    }\n     \n    automount_service_account_token = true\n\n    depends_on = [ \"azurerm_kubernetes_cluster.aks-ci\" ]\n}\n\n###############################################\n#     Create tiller cluster role binding      #\n############################################### \n resource \"kubernetes_cluster_role_binding\" \"tiller\" {\n    provider = \"kubernetes.aks-ci\"\n\n    metadata {\n        name = \"tiller\"\n    }\n\n    role_ref {\n         kind      = \"ClusterRole\"\n         name      = \"cluster-admin\"\n         api_group = \"rbac.authorization.k8s.io\"\n    }\n\n    subject {\n        kind      = \"ServiceAccount\"\n        name      = \"${kubernetes_service_account.tiller.metadata.0.name}\"\n        api_group = \"\"\n        namespace = \"kube-system\"\n    }\n\n    depends_on = [\"kubernetes_service_account.tiller\"]\n }\n\n###############################################\n#   Save kube-config into azure_config file   #\n###############################################\nresource \"null_resource\" \"save-kube-config\" {\n\n    triggers = {\n        config = \"${azurerm_kubernetes_cluster.aks-ci.kube_config_raw}\"\n    }\n    provisioner \"local-exec\" {\n        command = \"mkdir -p ${path.module}\/.kube &amp;&amp; echo '${azurerm_kubernetes_cluster.aks-ci.kube_config_raw}' &gt; ${path.module}\/.kube\/azure_config &amp;&amp; chmod 0600 ${path.module}\/.kube\/azure_config\"\n    }\n\n    depends_on = [ \"azurerm_kubernetes_cluster.aks-ci\" ]\n}\n\n###############################################\n#    Create Azure public IP and DNS for       #\n#    Azure load balancer                      #\n###############################################\nresource \"azurerm_public_ip\" \"nginx_ingress\" {\n  \n    name                = \"nginx_ingress-ip\"\n    location            = \"WestEurope\"\n    resource_group_name = \"${azurerm_kubernetes_cluster.aks-ci.node_resource_group}\" #\"${azurerm_resource_group.aks-ci.name}\"\n    allocation_method   = \"Static\"\n    domain_name_label   = \"${var.domain_name_label}\"\n\n    tags = {\n        environment = \"CI\"\n    }\n\n    depends_on = [ \"azurerm_kubernetes_cluster.aks-ci\" ]\n}\n\n###############################################\n#       Create namespace nginx_ingress        #\n###############################################\nresource \"kubernetes_namespace\" \"nginx_ingress\" {\n    provider = \"kubernetes.aks-ci\"\n\n    metadata {\n        name = \"ingress-basic\"\n    } \n\n    depends_on = [ \"azurerm_kubernetes_cluster.aks-ci\" ]\n}\n\n###############################################\n#       Create namespace cert-manager         #\n###############################################\nresource \"kubernetes_namespace\" \"cert-manager\" {\n    provider = \"kubernetes.aks-ci\"\n\n    metadata {\n        name = \"cert-manager\"\n    } \n\n    depends_on = [ \"azurerm_kubernetes_cluster.aks-ci\" ]\n}\n\n###############################################\n#       Create namespace kubeinvaders         #\n###############################################\nresource \"kubernetes_namespace\" \"kubeinvaders\" {\n    provider = \"kubernetes.aks-ci\"\n    \n    metadata {\n        name = \"foobar\"\n    } \n    \n    depends_on = [ \"azurerm_kubernetes_cluster.aks-ci\" ]\n}\n\n###############################################\n#             Load Provider helm              #\n###############################################\n\nprovider \"helm\" {\n    install_tiller  = true\n    service_account = \"${kubernetes_service_account.tiller.metadata.0.name}\"\n\n    kubernetes {\n        host                   = \"${azurerm_kubernetes_cluster.aks-ci.kube_config.0.host}\"\n        client_certificate     = \"${base64decode(azurerm_kubernetes_cluster.aks-ci.kube_config.0.client_certificate)}\"\n        client_key             = \"${base64decode(azurerm_kubernetes_cluster.aks-ci.kube_config.0.client_key)}\"\n        cluster_ca_certificate = \"${base64decode(azurerm_kubernetes_cluster.aks-ci.kube_config.0.cluster_ca_certificate)}\"\n    }\n\n}\n\n###############################################\n#        Load helm stable repository          #\n###############################################\ndata \"helm_repository\" \"stable\" {\n  name = \"stable\"\n  url  = \"https:\/\/kubernetes-charts.storage.googleapis.com\"\n}\n\n###############################################\n#       Install nginx ingress controller      #\n###############################################\nresource \"helm_release\" \"nginx_ingress\" {\n\n     name       = \"nginx-ingress\"\n     repository = \"${data.helm_repository.stable.metadata.0.name}\"\n     chart      = \"nginx-ingress\"\n     timeout    = 2400\n     namespace  = \"${kubernetes_namespace.nginx_ingress.metadata.0.name}\"\n\n     set {\n         name  = \"controller.replicaCount\"\n         value = \"1\"\n     }\n     set {\n         name  = \"controller.service.loadBalancerIP\"\n         value = \"${azurerm_public_ip.nginx_ingress.ip_address}\"\n     }\n     set_string {\n         name  = \"service.beta.kubernetes.io\/azure-load-balancer-resource-group\"\n         value = \"${azurerm_resource_group.aks-ci.name}\"\n     }\n\n    depends_on = [ \"kubernetes_cluster_role_binding.tiller\" ]\n}\n\n###############################################\n#       Install and configure cert_manager    #\n###############################################\nresource \"helm_release\" \"cert_manager\" {\n    keyring = \"\"\n    name = \"cert-manager\"\n    chart = \"stable\/cert-manager\"\n    namespace = \"kube-system\"\n    \n    depends_on = [\"helm_release.nginx_ingress\"]\n    \n    set {\n         name  = \"webhook.enabled\"\n         value = \"false\"\n    }\n\n    provisioner \"local-exec\" {\n        command = \"kubectl --kubeconfig=${path.module}\/.kube\/azure_config apply -f https:\/\/raw.githubusercontent.com\/jetstack\/cert-manager\/release-0.6\/deploy\/manifests\/00-crds.yaml\"\n    }\n    provisioner \"local-exec\" {\n        command = \"kubectl --kubeconfig=${path.module}\/.kube\/azure_config  label namespace kube-system certmanager.k8s.io\/disable-validation=\\\"true\\\" --overwrite\"\n    }\n    provisioner \"local-exec\" {\n        command = \"kubectl --kubeconfig=${path.module}\/.kube\/azure_config create -f ${path.module}\/cluster_issuer\/cluster-issuer.yaml\"\n    }\n}\n\n###############################################\n#            Install Kubeinvaders             #\n###############################################\nresource \"null_resource\" \"kubeinvaders\" {\n    triggers = {\n        build_number = \"${timestamp()}\"\n        config = \"${azurerm_kubernetes_cluster.aks-ci.kube_config_raw}\"\n    }\n    \n    depends_on = [\"helm_release.nginx_ingress\",\"helm_release.cert_manager\"]\n    provisioner \"local-exec\" {\n        command = \"sed -i \\\"0,\/ROUTE_HOST=.*\/ROUTE_HOST=${var.domain_name_label}.westeurope.cloudapp.azure.com\/\\\" ${path.module}\/KubeInvaders\/deploy_kubeinvaders.sh\"\n    }\n    provisioner \"local-exec\" {\n        command = \"sed \\\"s\/||toto||\/${var.domain_name_label}.westeurope.cloudapp.azure.com\/\\\" ${path.module}\/KubeInvaders\/kubernetes\/kubeinvaders-ingress.template &gt; ${path.module}\/KubeInvaders\/kubernetes\/kubeinvaders-ingress.yml\"\n    }\n    provisioner \"local-exec\" {\n        command = \"cd ${path.module}\/KubeInvaders &amp;&amp; .\/deploy_kubeinvaders.sh\"\n    }\n}<\/pre>\n<ul>\n<li>\u00a0output.tf<\/li>\n<\/ul>\n<pre class=\"brush: xml; gutter: true; first-line: 1\">output \"client_key\" {\n    value = \"${azurerm_kubernetes_cluster.aks-ci.kube_config.0.client_key}\"\n}\n\noutput \"client_certificate\" {\n    value = \"${azurerm_kubernetes_cluster.aks-ci.kube_config.0.client_certificate}\"\n}\n\noutput \"cluster_ca_certificate\" {\n    value = \"${azurerm_kubernetes_cluster.aks-ci.kube_config.0.cluster_ca_certificate}\"\n}\n\noutput \"cluster_username\" {\n    value = \"${azurerm_kubernetes_cluster.aks-ci.kube_config.0.username}\"\n}\n\noutput \"cluster_password\" {\n    value = \"${azurerm_kubernetes_cluster.aks-ci.kube_config.0.password}\"\n}\n\noutput \"kube_config\" {\n    value = \"${azurerm_kubernetes_cluster.aks-ci.kube_config_raw}\"\n}\n\noutput \"host\" {\n    value = \"${azurerm_kubernetes_cluster.aks-ci.kube_config.0.host}\"\n}<\/pre>\n<p>After provisioning my AKS cluster through Terraform here the funny result &#8230; \ud83d\ude42<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-35016 size-full\" src=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/165-2-terraform-kubeinvaders-e1572193472942.jpg\" alt=\"\" width=\"900\" height=\"549\" \/><\/p>\n<p>Et voil\u00e0! Next time, I will continue with a write-up about provisioning an AKS cluster through DevOps Azure and terraform module.<\/p>\n<p>See you!<\/p>\n<p><span style=\"float: none; background-color: #ffffff; color: #333333; cursor: text; font-family: Georgia,'Times New Roman','Bitstream Charter',Times,serif; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none;\">By David Barbarin<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Provisioning a K8s infrastructure may be performed in different ways. Terraform has a connector called the Kubernetes provider but it doesn\u2019t allow building and deploying a Kubernetes cluster. The cluster must be up and running before using the provider. Fortunately, there are different cloud-specific provider depending which cloud provider you want to provision your cluster. [&hellip;]<\/p>\n","protected":false},"author":26,"featured_media":12917,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[955,1320,1522],"tags":[151,1725,89,1340],"type_dbi":[],"class_list":["post-12915","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-cloud","category-devops","category-kubernetes","tag-devops","tag-kubeinvaders","tag-kubernetes","tag-terraform"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.2 (Yoast SEO v27.2) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Provisioning a AKS cluster and KubeInvaders with Terraform - dbi Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.dbi-services.com\/blog\/provisioning-a-aks-cluster-and-kubeinvaders-with-terraform-aks\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Provisioning a AKS cluster and KubeInvaders with Terraform\" \/>\n<meta property=\"og:description\" content=\"Provisioning a K8s infrastructure may be performed in different ways. Terraform has a connector called the Kubernetes provider but it doesn\u2019t allow building and deploying a Kubernetes cluster. The cluster must be up and running before using the provider. Fortunately, there are different cloud-specific provider depending which cloud provider you want to provision your cluster. [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.dbi-services.com\/blog\/provisioning-a-aks-cluster-and-kubeinvaders-with-terraform-aks\/\" \/>\n<meta property=\"og:site_name\" content=\"dbi Blog\" \/>\n<meta property=\"article:published_time\" content=\"2019-10-27T15:32:17+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-07-13T14:38:55+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/165-1-CI-AKS.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"596\" \/>\n\t<meta property=\"og:image:height\" content=\"362\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Microsoft Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Microsoft Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/provisioning-a-aks-cluster-and-kubeinvaders-with-terraform-aks\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/provisioning-a-aks-cluster-and-kubeinvaders-with-terraform-aks\/\"},\"author\":{\"name\":\"Microsoft Team\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/bfab48333280d616e1170e7369df90a4\"},\"headline\":\"Provisioning a AKS cluster and KubeInvaders with Terraform\",\"datePublished\":\"2019-10-27T15:32:17+00:00\",\"dateModified\":\"2023-07-13T14:38:55+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/provisioning-a-aks-cluster-and-kubeinvaders-with-terraform-aks\/\"},\"wordCount\":694,\"commentCount\":0,\"image\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/provisioning-a-aks-cluster-and-kubeinvaders-with-terraform-aks\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/165-1-CI-AKS.jpg\",\"keywords\":[\"DevOps\",\"KubeInvaders\",\"kubernetes\",\"Terraform\"],\"articleSection\":[\"Cloud\",\"DevOps\",\"Kubernetes\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.dbi-services.com\/blog\/provisioning-a-aks-cluster-and-kubeinvaders-with-terraform-aks\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/provisioning-a-aks-cluster-and-kubeinvaders-with-terraform-aks\/\",\"url\":\"https:\/\/www.dbi-services.com\/blog\/provisioning-a-aks-cluster-and-kubeinvaders-with-terraform-aks\/\",\"name\":\"Provisioning a AKS cluster and KubeInvaders with Terraform - dbi Blog\",\"isPartOf\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/provisioning-a-aks-cluster-and-kubeinvaders-with-terraform-aks\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/provisioning-a-aks-cluster-and-kubeinvaders-with-terraform-aks\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/165-1-CI-AKS.jpg\",\"datePublished\":\"2019-10-27T15:32:17+00:00\",\"dateModified\":\"2023-07-13T14:38:55+00:00\",\"author\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/bfab48333280d616e1170e7369df90a4\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/provisioning-a-aks-cluster-and-kubeinvaders-with-terraform-aks\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.dbi-services.com\/blog\/provisioning-a-aks-cluster-and-kubeinvaders-with-terraform-aks\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/provisioning-a-aks-cluster-and-kubeinvaders-with-terraform-aks\/#primaryimage\",\"url\":\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/165-1-CI-AKS.jpg\",\"contentUrl\":\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/165-1-CI-AKS.jpg\",\"width\":596,\"height\":362},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/provisioning-a-aks-cluster-and-kubeinvaders-with-terraform-aks\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Accueil\",\"item\":\"https:\/\/www.dbi-services.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Provisioning a AKS cluster and KubeInvaders with Terraform\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#website\",\"url\":\"https:\/\/www.dbi-services.com\/blog\/\",\"name\":\"dbi Blog\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.dbi-services.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/bfab48333280d616e1170e7369df90a4\",\"name\":\"Microsoft Team\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/secure.gravatar.com\/avatar\/c44a1a792c059f24055763aa77d80a244467f6eef724a8bd13db8d4a350b7a4c?s=96&d=mm&r=g\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/c44a1a792c059f24055763aa77d80a244467f6eef724a8bd13db8d4a350b7a4c?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/c44a1a792c059f24055763aa77d80a244467f6eef724a8bd13db8d4a350b7a4c?s=96&d=mm&r=g\",\"caption\":\"Microsoft Team\"},\"url\":\"https:\/\/www.dbi-services.com\/blog\/author\/microsoft-team\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Provisioning a AKS cluster and KubeInvaders with Terraform - dbi Blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.dbi-services.com\/blog\/provisioning-a-aks-cluster-and-kubeinvaders-with-terraform-aks\/","og_locale":"en_US","og_type":"article","og_title":"Provisioning a AKS cluster and KubeInvaders with Terraform","og_description":"Provisioning a K8s infrastructure may be performed in different ways. Terraform has a connector called the Kubernetes provider but it doesn\u2019t allow building and deploying a Kubernetes cluster. The cluster must be up and running before using the provider. Fortunately, there are different cloud-specific provider depending which cloud provider you want to provision your cluster. [&hellip;]","og_url":"https:\/\/www.dbi-services.com\/blog\/provisioning-a-aks-cluster-and-kubeinvaders-with-terraform-aks\/","og_site_name":"dbi Blog","article_published_time":"2019-10-27T15:32:17+00:00","article_modified_time":"2023-07-13T14:38:55+00:00","og_image":[{"width":596,"height":362,"url":"http:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/165-1-CI-AKS.jpg","type":"image\/jpeg"}],"author":"Microsoft Team","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Microsoft Team","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.dbi-services.com\/blog\/provisioning-a-aks-cluster-and-kubeinvaders-with-terraform-aks\/#article","isPartOf":{"@id":"https:\/\/www.dbi-services.com\/blog\/provisioning-a-aks-cluster-and-kubeinvaders-with-terraform-aks\/"},"author":{"name":"Microsoft Team","@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/bfab48333280d616e1170e7369df90a4"},"headline":"Provisioning a AKS cluster and KubeInvaders with Terraform","datePublished":"2019-10-27T15:32:17+00:00","dateModified":"2023-07-13T14:38:55+00:00","mainEntityOfPage":{"@id":"https:\/\/www.dbi-services.com\/blog\/provisioning-a-aks-cluster-and-kubeinvaders-with-terraform-aks\/"},"wordCount":694,"commentCount":0,"image":{"@id":"https:\/\/www.dbi-services.com\/blog\/provisioning-a-aks-cluster-and-kubeinvaders-with-terraform-aks\/#primaryimage"},"thumbnailUrl":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/165-1-CI-AKS.jpg","keywords":["DevOps","KubeInvaders","kubernetes","Terraform"],"articleSection":["Cloud","DevOps","Kubernetes"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.dbi-services.com\/blog\/provisioning-a-aks-cluster-and-kubeinvaders-with-terraform-aks\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.dbi-services.com\/blog\/provisioning-a-aks-cluster-and-kubeinvaders-with-terraform-aks\/","url":"https:\/\/www.dbi-services.com\/blog\/provisioning-a-aks-cluster-and-kubeinvaders-with-terraform-aks\/","name":"Provisioning a AKS cluster and KubeInvaders with Terraform - dbi Blog","isPartOf":{"@id":"https:\/\/www.dbi-services.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.dbi-services.com\/blog\/provisioning-a-aks-cluster-and-kubeinvaders-with-terraform-aks\/#primaryimage"},"image":{"@id":"https:\/\/www.dbi-services.com\/blog\/provisioning-a-aks-cluster-and-kubeinvaders-with-terraform-aks\/#primaryimage"},"thumbnailUrl":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/165-1-CI-AKS.jpg","datePublished":"2019-10-27T15:32:17+00:00","dateModified":"2023-07-13T14:38:55+00:00","author":{"@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/bfab48333280d616e1170e7369df90a4"},"breadcrumb":{"@id":"https:\/\/www.dbi-services.com\/blog\/provisioning-a-aks-cluster-and-kubeinvaders-with-terraform-aks\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.dbi-services.com\/blog\/provisioning-a-aks-cluster-and-kubeinvaders-with-terraform-aks\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.dbi-services.com\/blog\/provisioning-a-aks-cluster-and-kubeinvaders-with-terraform-aks\/#primaryimage","url":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/165-1-CI-AKS.jpg","contentUrl":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/165-1-CI-AKS.jpg","width":596,"height":362},{"@type":"BreadcrumbList","@id":"https:\/\/www.dbi-services.com\/blog\/provisioning-a-aks-cluster-and-kubeinvaders-with-terraform-aks\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Accueil","item":"https:\/\/www.dbi-services.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Provisioning a AKS cluster and KubeInvaders with Terraform"}]},{"@type":"WebSite","@id":"https:\/\/www.dbi-services.com\/blog\/#website","url":"https:\/\/www.dbi-services.com\/blog\/","name":"dbi Blog","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.dbi-services.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/bfab48333280d616e1170e7369df90a4","name":"Microsoft Team","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/c44a1a792c059f24055763aa77d80a244467f6eef724a8bd13db8d4a350b7a4c?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/c44a1a792c059f24055763aa77d80a244467f6eef724a8bd13db8d4a350b7a4c?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/c44a1a792c059f24055763aa77d80a244467f6eef724a8bd13db8d4a350b7a4c?s=96&d=mm&r=g","caption":"Microsoft Team"},"url":"https:\/\/www.dbi-services.com\/blog\/author\/microsoft-team\/"}]}},"_links":{"self":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts\/12915","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/users\/26"}],"replies":[{"embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/comments?post=12915"}],"version-history":[{"count":1,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts\/12915\/revisions"}],"predecessor-version":[{"id":26697,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts\/12915\/revisions\/26697"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/media\/12917"}],"wp:attachment":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/media?parent=12915"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/categories?post=12915"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/tags?post=12915"},{"taxonomy":"type","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/type_dbi?post=12915"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}