在marathon-lb上拒绝DCOS连接

时间:2017-09-17 18:09:43

标签: containers mesos marathon dcos

我有dcos启动并运行。我创建了一个服务,我可以通过ip:端口访问它,但是当我尝试用marathon-lb做同样的事情时,我无法达到它。我试过curl http://marathon-lb.marathon.mesos:10000/ 10000是端口号,我仍然拒绝连接。

这是我的服务json:

{


"id": "/nginx-external",
  "cmd": null,
  "cpus": 0.1,
  "mem": 65,
  "disk": 0,
  "instances": 1,
  "acceptedResourceRoles": [],
  "container": {
    "type": "DOCKER",
    "volumes": [],
    "docker": {
      "image": "nginx:1.7.7",
      "network": "BRIDGE",
      "portMappings": [
        {
          "containerPort": 80,
          "hostPort": 2000,
          "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
    }
  ],
  "labels": {
    "HAPROXY_GROUP": "external"
  },
  "portDefinitions": [
    {
      "port": 10000,
      "protocol": "tcp",
      "name": "default",
      "labels": {}
    }
  ]
}

任何人都可以提供帮助。

1 个答案:

答案 0 :(得分:1)

使用public-ip:10000(请参阅here查找公共IP)从集群外部访问它,并使用curl http://marathon-lb.marathon.mesos:10000/从集群内部工作正常。注意,您需要安装marathon-lb(dcos package install marathon-lb)并且只能从群集内部解析marathon-lb.marathon.mesos

为了调试marathon-lb问题,我首先检查haproxy统计信息:https://dcos.io/docs/1.9/networking/marathon-lb/marathon-lb-advanced-tutorial/#deploy-an-external-load-balancer-with-marathon-lb

来自群组外部  external access

来自群集内部

    core@ip-10-0-4-343 ~ $ curl  http://marathon-lb.marathon.mesos:10000/
<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
<style>
    body {
        width: 35em;
        margin: 0 auto;
        font-family: Tahoma, Verdana, Arial, sans-serif;
    }
</style>
</head>
<body>
<h1>Welcome to nginx!</h1>
<p>If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.</p>

<p>For online documentation and support please refer to
<a href="http://nginx.org/">nginx.org</a>.<br/>
Commercial support is available at
<a href="http://nginx.com/">nginx.com</a>.</p>

<p><em>Thank you for using nginx.</em></p>
</body>
</html>
相关问题