【问题标题】:unable to access helloworld App deployed using DCOS Marathon in Azure无法访问在 Azure 中使用 DCOS Marathon 部署的 helloworld App
【发布时间】:2018-02-28 10:26:54
【问题描述】:

我已经使用 DCOS 和 Marathon 框架在 Azure 中部署了一个 hello world 应用程序。我正在尝试使用 fqn: 托管应用程序的端口号来访问它。我无法打开应用程序

以下是我用过的json

{
  "id": "/dockercloud-hello-world",
  "cmd": null,
  "cpus": 0.1,
  "mem": 128,
  "disk": 0,
  "instances": 2,
  "acceptedResourceRoles": [
    "*"
  ],
  "container": {
    "type": "DOCKER",
    "volumes": [],
    "docker": {
      "image": "dockercloud/hello-world",
      "network": "BRIDGE",
      "portMappings": [
        {
          "containerPort": 80,
          "hostPort": 0,
          "servicePort": 10000,
          "protocol": "tcp",
          "labels": {}
        }
      ],
      "privileged": false,
      "parameters": [],
      "forcePullImage": true
    }
  },
  "healthChecks": [
    {
      "gracePeriodSeconds": 10,
      "intervalSeconds": 2,
      "timeoutSeconds": 10,
      "maxConsecutiveFailures": 10,
      "portIndex": 0,
      "path": "/",
      "protocol": "HTTP",
      "ignoreHttp1xx": false
    }
  ],
  "portDefinitions": [
    {
      "port": 10000,
      "protocol": "tcp",
      "name": "default",
      "labels": {}
    }
  ]
}

我已经为主 nsg 资源添加了 NSG 入站规则 我为主 lb 资源添加了 NAT 规则,允许自定义端口

【问题讨论】:

    标签: azure docker marathon dcos azure-container-service


    【解决方案1】:

    在您的示例中,host port 为 0,Azure 将在随机端口上侦听您的服务。您需要在 NSG 和 lb 上打开端口。

    我建议您可以指定端口,您可以查看以下示例:

    {
      "id": "/dockercloud-hello-world",
      "cmd": null,
      "cpus": 0.1,
      "mem": 32,
      "disk": 0,
      "instances": 1,
      "acceptedResourceRoles": [
        "slave_public"
      ],
      "container": {
        "type": "DOCKER",
        "volumes": [],
        "docker": {
          "image": "dockercloud/hello-world",
          "network": "BRIDGE",
          "portMappings": [
            {
              "containerPort": 80,
              "hostPort": 80,
              "protocol": "tcp",
              "labels": {},
              "name": "test80"
            }
          ],
          "privileged": false,
          "parameters": [],
          "forcePullImage": true
        }
      },
      "healthChecks": [
        {
          "gracePeriodSeconds": 10,
          "intervalSeconds": 2,
          "timeoutSeconds": 10,
          "maxConsecutiveFailures": 10,
          "portIndex": 0,
          "path": "/",
          "protocol": "MESOS_HTTP",
          "ignoreHttp1xx": false
        }
      ],
      "requirePorts": true
    }
    

    注意:您应该将acceptedResourceRoles 设置为slave_public。更多相关信息请查看link

    【讨论】:

    • 我尝试将主机端口更改为 80。它无法部署应用程序
    • 是的,我遇到了同样的错误,但是我修改了你的 json 文件。你可以复制我的 json,它会起作用。
    • 你需要添加` "acceptedResourceRoles": [ "slave_public" ],`
    • 这是我的测试结果imgur.com/a/x7BB9我建议你可以试试。
    • 我复制了评论中提供的json,甚至没有部署应用程序
    【解决方案2】:

    除了上面提到的 JSON,我还需要使用代理 URL 来访问应用程序。我错过了那个

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-10-16
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多