I have a working K8s cluster and have other projects in it already. I added the consul through helm in the same cluster that uses Kubenet as network.
The consul-ui is exposed to Load Balancer, so I can connect to it.
Now, I have additional VM that is not part of K8s cluster. I have installed consul agent on the VM, but when I am trying to connect it via the auto join method mentioned in the link Auto-join a Cloud Provider | Consul | HashiCorp Developer.
I updated the consul.env with the below variables: ARM_SUBSCRIPTION_ID=XXXX ARM_TENANT_ID=XXXX ARM_CLIENT_ID=XXXX ARM_CLIENT_SECRET=XXXX
where XXXX represents the actual values.
and in the consul.hcl, I used retry_join = [“provider=azure tag_name=consul tag_value=tag”]
now, I see below error:
Dec 23 17:10:27 hk-09-az bash[1494]: 2021-12-23T17:10:27.303+0800 [ERROR] agent: Cannot discover address: cluster=LAN address=“provider=azure tag_name=consul tag_value=tag” error=“discover-azure: azure.BearerAuthorizer#WithAuthorization: Failed to refresh the Token for request to https://management.azure.com/subscriptions//providers/Microsoft.Network/networkInterfaces?api-version=2015-06-15: StatusCode=400 – Original Error: adal: Refresh request failed. Status Code = ‘400’. Response body: {“error”:“invalid_request”,“error_description”:“Identity not found”}”
When I was using below configuration retry_join = [“provider=azure resource_group=XXXX vm_scale_set=XXXX tenant_id=XXXX client_id=XXXX subscription_id=XXXX secret_access_key=XXXX”]
Per the docs for using cloud auto-join with Azure, Can you confirm that you have properly applied the consul tag to the virtual NIC’s of the Consul servers in the tenant and subscription? If you are using a Virtual Machine Scale Set, this tag can be configured on the resource_group of the vm_scale_set.