我有 2 个服务的设置:A 和 B。有一个要求:
- 服务 B 应该能够访问服务 A
- 企业VPN内的用户可以访问服务B
我已经使用Terraform ECS 服务发现配置了设置,我在其中指定了服务 A 的一个service_registries
部分。和aws_service_discovery_private_dns_namespace
指定aws_service_discovery_service
如下。
resource "aws_service_discovery_private_dns_namespace" "example" {
name = "hoge.example.local"
description = "example"
vpc = aws_vpc.example.id
}
resource "aws_service_discovery_service" "example" {
name = "example"
dns_config {
namespace_id = aws_service_discovery_private_dns_namespace.example.id
dns_records {
ttl = 10
type = "SRV"
}
routing_policy = "MULTIVALUE"
}
health_check_custom_config {
failure_threshold = 1
}
}
我可以看到创建的 CloudMap 条目具有正确的命名空间,并且服务名称指向正确的 IP 地址。当我直接访问这个 IP 地址时http://10.1.0.16:9000
(在 VPN 下),我可以访问服务 A,但是当我使用 时http://example.hoge.example.local:9000
,浏览器会无限期地等待响应。我从一些文档中读到 SRV 记录查找与 A 记录查找不同,但我不知道如何解决这个问题。
包括设置图。
非常感谢!