Azure Arc for Kubernetes

Hi All,

I am trying to deploy a Azure ARC for Kubernetes. My Kubernetes cluster is in on prem and i want to create the Azure Arc for Kubernetes using terraform.

Using the Azure portal we have a option to Add a Kubernetes cluster with Azure ARC. Here we need to fill the RG name, Arc name, Connection type, Tags. And then we get a script to run which is az connectedk8s connect along with --name “asd” --resource-group “rgname” --location “westeurope” --correlation-id “XXX” --tags “Datacenter City StateOrDistrict CountryOrRegion”

But in the below link for terraform i don’t see the option of tags and connection. Its asking to pass public key. What does this mean?

https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/arc_kubernetes_cluster

I also do not see the option for enabling the connectivity method which is available in portal.

Could you help me understand how deployment of Azure Arc work using terraform ?

Hi @suvarnanith , there is an example about the azurerm_arc_kubernetes_cluster, the example is doing similar things like the az connectedk8s connect command, and actually the azurerm_arc_kubernetes_cluster corresponds to Connected Cluster - Create REST API method, which only register a instance on Azure, you need to handle other steps like deploy the Azure Arc agents to the cluster and install Helm.

Hi @teowa, Thank for replying. i have below questions

  1. azurerm_arc_kubernetes_cluster is asking for adding the public key. Which public key it is asking for?
  2. I have a on prem cluster and to install the agent i need to run Az Connect8s connect right?
  3. What will be the output when we run azurerm_arc_kubernetes_cluster in the terraform console and in azure portal? I am asking this question because i understand until the agent is installed the arc enabled cluster will not show up in the azure portal.
  4. If azurerm_arc_kubernetes_cluster is same as az connectedk8s connect. How azurerm_arc_kubernetes_cluster will connect the cluster? Because az connectedk8s connect needs to be run on Vm where cluster context is set?

Could you please answer?