I need solution to add the Kubernetes services inside the Traffic manager using terraform and in order to do that I need to have a public IP address for each cluster
Traffic Manager Profile
Traffic Manager Profile Resource
resource "azurerm_traffic_manager_profile" "converse_traffic_manager" {
name = "converse-traffic-manager"
resource_group_name = azurerm_resource_group.aks_rg.name
traffic_routing_method = "Weighted"
dns_config {
relative_name = "converse-dns"
ttl = 100
}
monitor_config {
protocol = "HTTP"
port = 7891
path = "/health"
interval_in_seconds = 30
timeout_in_seconds = 9
tolerated_number_of_failures = 3
}
}
resource "azurerm_traffic_manager_azure_endpoint" "converse_service_ep" {
name = "converse-service-ep"
profile_id = azurerm_traffic_manager_profile.converse_traffic_manager.id
target_resource_id = (tolist(azurerm_kubernetes_cluster.aks_cluster_wc1.network_profile.0.load_balancer_profile.0.effective_outbound_ips)[0])
weight = 1
}
type here
I get following error
│ Error: creating Endpoint Type (Subscription: “0def0707-b37a-42ae-8174-xxxxx”
│ Traffic Manager Profile Name: “converse-traffic-manager”
│ Endpoint Type: “AzureEndpoints”
│ Endpoint Name: “converse-service-ep”): unexpected status 400 (400 Bad Request) with error: BadRequest: The resource ‘/subscriptions/0def0707-b37a-42ae-8174-d6842db7c1d8/resourceGroups/node-rg-k8s-stg-use1-az-cnv-01/providers/Microsoft.Network/publicIPAddresses/ff18c553-9ab4-4500-a00a-1a62a347d720’ specified by the targetResourceId for endpoint ‘converse-service-ep’ does not have a DNS name.
If I replace the target_resource_id with following statement
“/subscriptions/0def0707-b37a-42ae-8174-xxxxxx/resourceGroups/node-rg-k8s-stg-use1-az-cnv-01/providers/Microsoft.Network/publicIPAddresses/ConverseLoadBalancerPublicIp”, then endpoint is added successfully
I get following error │ Error: creating Endpoint Type (Subscription: “0def0707-b37a-42ae-8174-xxxxx”
│ Traffic Manager Profile Name: “converse-traffic-manager” │ Endpoint Type: “AzureEndpoints” │ Endpoint Name: “converse-service-ep”): unexpected status 400 (400 Bad Request) with error: BadRequest: The resource ‘/subscriptions/0def0707-b37a-42ae-8174-d6842db7c1d8/resourceGroups/node-rg-k8s-stg-use1-az-cnv-01/providers/Microsoft.Network/publicIPAddresses/ff18c553-9ab4-4500-a00a-1a62a347d720’ specified by the targetResourceId for endpoint ‘converse-service-ep’ does not have a DNS name.
If I replace the target_resource_id with following statement
“/subscriptions/0def0707-b37a-42ae-8174-xxxxxx/resourceGroups/node-rg-k8s-stg-use1-az-cnv-01/providers/Microsoft.Network/publicIPAddresses/ConverseLoadBalancerPublicIp”, then endpoint is added successfully
neeraj310 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.