无法访问使用Azure中的DCOS Marathon部署的helloworld App

问题描述 投票:2回答:2

我使用DCOS和Marathon Framework在Azure中部署了一个hello world应用程序。我正在尝试使用托管应用程序的fqn:portnumber访问它。我无法打开该应用程序

以下是我用过的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
2个回答
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


1
投票

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

最新问题
© www.soinside.com 2019 - 2024. All rights reserved.