我正在尝试公开两个服务(Web API 和聊天机器人),它们通过Service Fabric Mesh Network 的入口控制器在内部打开相同的端口。
运行下面的定义总是会让两个服务之一失败。
我不清楚的是:
- 那是因为它们都在内部打开相同的端口(80 和 443)吗?
- 这通常是一个坏主意,我应该使用像 NGINX 这样的反向代理吗?
- 我可以为这两项服务获得两个不同的 IP 地址吗?
文件:
{
"$schema": "http://schema.management.azure.com/schemas/2014-04-01-preview/deploymentTemplate.json",
"contentVersion": "1.0.0.0",
"resources": [
{
"apiVersion": "2018-07-01-preview",
"name": "contosomaintenance",
"type": "Microsoft.ServiceFabricMesh/applications",
"location": "westeurope",
"dependsOn": [
"Microsoft.ServiceFabricMesh/networks/contosomaintenance-network"
],
"properties": {
"services": [
{
"name": "contosomaintenance-api",
"properties": {
"description": "Contoso Maintenance REST API",
"osType": "Linux",
"codePackages": [
{
"name": "contosomaintenance-api",
"image": "robinmanuelthiel/contosomaintenance-api:latest",
"endpoints": [
{
"name": "http",
"port": 80
},
{
"name": "https",
"port": 443
}
],
"resources": {
"requests": {
"cpu": "0.5",
"memoryInGB": "1"
}
}
}
],
"replicaCount": "1",
"networkRefs": [
{
"name": "[resourceId('Microsoft.ServiceFabricMesh/networks', 'contosomaintenance-network')]"
}
]
}
},
{
"name": "contosomaintenance-bot",
"properties": {
"description": "Contoso Maintenance Chat Bot",
"osType": "Linux",
"codePackages": [
{
"name": "contosomaintenance-bot",
"image": "robinmanuelthiel/contosomaintenance-bot:latest",
"endpoints": [
{
"name": "http",
"port": 80
},
{
"name": "https",
"port": 443
}
],
"resources": {
"requests": {
"cpu": "0.5",
"memoryInGB": "1"
}
}
}
],
"replicaCount": "1",
"networkRefs": [
{
"name": "[resourceId('Microsoft.ServiceFabricMesh/networks', 'contosomaintenance-network')]"
}
]
}
}
]
}
},
{
"apiVersion": "2018-07-01-preview",
"name": "contosomaintenance-network",
"type": "Microsoft.ServiceFabricMesh/networks",
"location": "westeurope",
"dependsOn": [],
"properties": {
"description": "Contoso Maintenance Network",
"addressPrefix": "10.0.0.0/22",
"ingressConfig": {
"layer4": [
{
"name": "contosomaintenance-api-ingress-http",
"publicPort": "20001",
"applicationName": "contosomaintenance",
"serviceName": "contosomaintenance-api",
"endpointName": "http"
},
{
"name": "contosomaintenance-api-ingress-bot",
"publicPort": "20002",
"applicationName": "contosomaintenance",
"serviceName": "contosomaintenance-bot",
"endpointName": "http"
}
]
}
}
}
]
}