首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >如何查找服务fabric mesh服务的公共IP地址

如何查找服务fabric mesh服务的公共IP地址
EN

Stack Overflow用户
提问于 2018-11-16 03:31:56
回答 1查看 1.4K关注 0票数 0

在部署了Service服务之后,如何找到面向外部的IP地址。到目前为止,事情还在努力:

  1. 查看Azure门户中服务的属性和设置
  2. 运行命令az mesh app list -这显示了一个有效的响应,但是IP地址丢失了。
  3. 运行命令az mesh app show -这显示了一个有效的响应,但是IP地址丢失了。
  4. 运行命令az mesh service list -这显示了一个有效的响应,但是IP地址丢失了。
  5. 运行命令az mesh service show -这显示了一个有效的响应,但是IP地址丢失了。
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2018-11-16 12:57:16

更新2018-12-10

新的ApiVersion已经发布(2018-09-01-预览),公开服务的新方法是使用网关资源。可以在 github线程上找到更多信息,并且已经在原始答案中添加了一个示例。

原始答案

您要查找的是网络公共IP地址:

az mesh network show --resource-group myResourceGroup --name myAppNetwork

公共网络

部署应用程序时,将其放置在网络资源中,此网络将提供对应用程序的访问。

中定义网络的示例:

代码语言:javascript
运行
复制
{
  "$schema": "http://schema.management.azure.com/schemas/2014-04-01-preview/deploymentTemplate.json",
  "contentVersion": "1.0.0.0",
  "parameters": {
    "location": {
      "type": "string",
      "metadata": {
        "description": "Location of the resources."
      }
    }
  },
  "resources": [
    {
      "apiVersion": "2018-07-01-preview",
      "name": "helloWorldNetwork",
      "type": "Microsoft.ServiceFabricMesh/networks",
      "location": "[parameters('location')]",
      "dependsOn": [],
      "properties": {
        "addressPrefix": "10.0.0.4/22",
        "ingressConfig": {
          "layer4": [
            {
              "name": "helloWorldIngress",
              "publicPort": "80",
              "applicationName": "helloWorldApp",
              "serviceName": "helloWorldService",
              "endpointName": "helloWorldListener"
            }
          ]
        }
      }
    },
    {
      "apiVersion": "2018-07-01-preview",
      "name": "helloWorldApp",
      "type": "Microsoft.ServiceFabricMesh/applications",
      "location": "[parameters('location')]",
      "dependsOn": [
        "Microsoft.ServiceFabricMesh/networks/helloWorldNetwork"
      ],
      "properties": {
        "description": "Service Fabric Mesh HelloWorld Application!",
        "services": [
          {
            "type": "Microsoft.ServiceFabricMesh/services",
            "location": "[parameters('location')]",
            "name": "helloWorldService",
            "properties": {
              "description": "Service Fabric Mesh Hello World Service.",
              "osType": "linux",
              "codePackages": [
                {
                  "name": "helloWorldCode",
                  "image": "seabreeze/azure-mesh-helloworld:1.1-alpine",
                  "endpoints": [
                    {
                      "name": "helloWorldListener",
                      "port": "80"
                    }
                  ],
                  "resources": {
                    "requests": {
                      "cpu": "1",
                      "memoryInGB": "1"
                    }
                  }
                },
                {
                  "name": "helloWorldSideCar",
                  "image": "seabreeze/azure-mesh-helloworld-sidecar:1.0-alpine",
                  "resources": {
                    "requests": {
                      "cpu": "1",
                      "memoryInGB": "1"
                    }
                  }
                }
              ],
              "replicaCount": "1",
              "networkRefs": [
                {
                  "name": "[resourceId('Microsoft.ServiceFabricMesh/networks', 'helloWorldNetwork')]"
                }
              ]
            }
          }
        ]
      }
    }
  ]
}

来源

网关(预览)

有计划提供一个网关,它将连接到内部网络的外部接入,在kubernetes像一个入口一样工作,它仍在预览中,解决方案如下:

代码语言:javascript
运行
复制
{
  "$schema": "http://schema.management.azure.com/schemas/2014-04-01-preview/deploymentTemplate.json",
  "contentVersion": "1.0.0.0",
  "parameters": {
    "location": {
      "type": "string",
      "defaultValue": "[resourceGroup().location]",
      "metadata": {
        "description": "Location of the resources (e.g. westus, eastus, westeurope)."
      }
    },
    "fileShareName": {
      "type": "string",
      "metadata": {
        "description": "Name of the Azure Files file share that provides the volume for the container."
      }
    },
    "storageAccountName": {
      "type": "string",
      "metadata": {
        "description": "Name of the Azure storage account that contains the file share."
      }
    },
    "storageAccountKey": {
      "type": "securestring",
      "metadata": {
        "description": "Access key for the Azure storage account that contains the file share."
      }
    },
    "stateFolderName": {
      "type": "string",
      "defaultValue": "CounterService",
      "metadata": {
        "description": "Folder in which to store the state. Provide a empty value to create a unique folder for each container to store the state. A non-empty value will retain the state across deployments, however if more than one applications are using the same folder, the counter may update more frequently."
      }
    }
  },
  "resources": [
    {
      "apiVersion": "2018-09-01-preview",
      "name": "counterAzureFileShareAccountKey",
      "type": "Microsoft.ServiceFabricMesh/secrets",
      "location": "[parameters('location')]",
      "dependsOn": [],
      "properties": {
        "kind": "inlinedValue",
        "contentType": "text/plain",
        "description": "Access key for the Azure storage account that contains the file share."
      }
    },
    {
      "apiVersion": "2018-09-01-preview",
      "name": "counterAzureFileShareAccountKey/v1",
      "type": "Microsoft.ServiceFabricMesh/secrets/values",
      "location": "[parameters('location')]",
      "dependsOn": [
        "Microsoft.ServiceFabricMesh/secrets/counterAzureFileShareAccountKey"
      ],
      "properties": {
        "value": "[parameters('storageAccountKey')]"
      }
    },
    {
      "apiVersion": "2018-09-01-preview",
      "name": "counterVolume",
      "type": "Microsoft.ServiceFabricMesh/volumes",
      "location": "[parameters('location')]",
      "dependsOn": [
        "Microsoft.ServiceFabricMesh/secrets/counterAzureFileShareAccountKey/values/v1"
      ],
      "properties": {
        "description": "Azure Files storage volume for counter App.",
        "provider": "SFAzureFile",
        "azureFileParameters": {
          "shareName": "[parameters('fileShareName')]",
          "accountName": "[parameters('storageAccountName')]",
          "accountKey": "[resourceId('Microsoft.ServiceFabricMesh/secrets/values','counterAzureFileShareAccountKey','v1')]"
        }
      }
    },
    {
      "apiVersion": "2018-09-01-preview",
      "name": "counterNetwork",
      "type": "Microsoft.ServiceFabricMesh/networks",
      "location": "[parameters('location')]",
      "dependsOn": [],
      "properties": {
        "kind": "Local",
        "description": "Azure Service Fabric Mesh Counter Application network.",
        "networkAddressPrefix": "10.0.0.0/24"
      }
    },
    {
      "apiVersion": "2018-09-01-preview",
      "name": "counterApp",
      "type": "Microsoft.ServiceFabricMesh/applications",
      "location": "[parameters('location')]",
      "dependsOn": [
        "Microsoft.ServiceFabricMesh/networks/counterNetwork",
        "Microsoft.ServiceFabricMesh/volumes/counterVolume"
      ],
      "properties": {
        "description": "Azure Service Fabric Mesh Counter Application.",
        "services": [
          {
            "name": "counterService",
            "properties": {
              "description": "A web service that serves the counter value stored in the Azure Files volume.",
              "osType": "linux",
              "codePackages": [
                {
                  "name": "counterCode",
                  "image": "seabreeze/azure-mesh-counter:0.1-alpine",
                  "volumeRefs": [
                    {
                      "name": "[resourceId('Microsoft.ServiceFabricMesh/volumes', 'counterVolume')]",
                      "destinationPath": "/app/data"
                    }
                  ],
                  "endpoints": [
                    {
                      "name": "counterServiceListener",
                      "port": 80
                    }
                  ],
                  "environmentVariables": [
                    {
                      "name": "STATE_FOLDER_NAME",
                      "value": "[parameters('stateFolderName')]"
                    }
                  ],
                  "resources": {
                    "requests": {
                      "cpu": 0.5,
                      "memoryInGB": 0.5
                    }
                  }
                }
              ],
              "replicaCount": 1,
              "networkRefs": [
                {
                  "name": "[resourceId('Microsoft.ServiceFabricMesh/networks', 'counterNetwork')]",
                  "endpointRefs": [
                    {
                      "name": "counterServiceListener"
                    }
                  ]
                }
              ]
            }
          }
        ]
      }
    },
    {
      "apiVersion": "2018-09-01-preview",
      "name": "counterGateway",
      "type": "Microsoft.ServiceFabricMesh/gateways",
      "location": "[parameters('location')]",
      "dependsOn": [
        "Microsoft.ServiceFabricMesh/networks/counterNetwork"
      ],
      "properties": {
        "description": "Service Fabric Mesh Gateway for counter sample.",
        "sourceNetwork": {
          "name": "Open"
        },
        "destinationNetwork": {
          "name": "[resourceId('Microsoft.ServiceFabricMesh/networks', 'counterNetwork')]"
        },
        "tcp": [
          {
            "name": "web",
            "port": 80,
            "destination": {
              "applicationName": "counterApp",
              "serviceName": "counterService",
              "endpointName": "counterServiceListener"
            }
          }
        ]
      }
    }
  ],
  "outputs": {
    "publicIPAddress": {
      "value": "[reference('counterGateway').ipAddress]",
      "type": "string"
    }
  }
}

来源

票数 4
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/53331014

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档