Marathon HealthCheck Failed


两个Mesos Master,三个Slave;
Mesos Version : 1.1.0
Marathon Version : 1.3.6

[root@slave1 ~]# docker ps -a
CONTAINER ID        IMAGE                                        COMMAND                  CREATED             STATUS                          PORTS                                           NAMES
7ceee4973dbc        calico/node-libnetwork:v0.9.0                "./start.sh"             2 hours ago         Up 2 hours                                                                      calico-libnetwork
f750530356ec        calico/node:v0.22.0                          "/sbin/start_runit"      2 hours ago         Up 2 hours                                                                      calico-node
9bc7f81c8e84        172.30.30.8:80/cp_project/syslog:v17.01.03   "/start"                 3 days ago          Up 3 days                       0.0.0.0:31514->514/tcp                          mesos-1e68ea0f-0f0b-4f14-8e2e-ab10169ee5f3-S0.940670f3-24be-4f75-b6ba-18afc04a2928
[root@slave1 ~]# 


采用 Calico 来管理 Docker 网络;

下面是使用 Marathon API 提交创建应用的 JSON 文件:
{
    "id": "nginx",
        "cmd": null,
        "cpus": 1,
        "mem": 128,
        "disk": 0,
        "instances": 3,
        "ipAddress": {
            "networkName": "my-calico-net"
        },
    "constraints": [["hostname", "UNIQUE"]],
    "container": {
            "docker": {
                 "image": "172.30.30.8:80/cp_project/nginx:v17.01.08",
                 "network": "USER",
                 "parameters": [
                      { "key": "log-driver", "value": "syslog" },
                      { "key": "log-opt", "value": "syslog-address=tcp://127.0.0.1:31514" },
                      { "key": "log-opt", "value": "tag=nginx" }
                 ],
                 "portMappings": [
                      { "containerPort": 80, "hostPort": 31080, "servicePort": 0, "name": "http" },
                      { "containerPort": 443, "hostPort": 31443, "servicePort": 0, "name": "https" }
                 ]
            },
        "type": "DOCKER",
        "volumes": []
        },
    "healthChecks": [
            {
                "protocol": "TCP",
                "gracePeriodSeconds": 300,
                "intervalSeconds": 60,
                "timeoutSeconds": 20,
                "port": 31080,
                "maxConsecutiveFailures": 3
            }
        ]
}


在 healthChecks 部分始终都是失败的;我改成如下:

{
"path": "/",
"portIndex": 0,
"protocol": "HTTP",
"gracePeriodSeconds": 300,
"intervalSeconds": 60,
"timeoutSeconds": 20,
"maxConsecutiveFailures": 3,
"ignoreHttp1xx": false
}

其检查也是 Unhealthy 的。日志中显示如下:

m1.png


请教下各位,为什么会出现这问题?
已邀请:

wisen

赞同来自:


你这个问题应该是网络导致的,看看宿主机网络和容器网络通不通(在marathon所在节点telnet一下容器ip:port)。

wisen

赞同来自:


已确认。网络问题导致(确保marathon所在地能curl -i -v 192.168.23.235:8080)。测试json如下:
{
"id": "/calico/net23-235",
"cmd": "catalina.sh run",
"cpus": 1,
"mem": 1024,
"disk": 0,
"instances": 1,
"constraints": [
[
  "hostname",
  "LIKE",
  "10.78.224.246"
]
],
"ipAddress": { 
"networkName": "net23" 
},
"container": {
"type": "DOCKER",
"volumes": [],
"docker": {
  "image": "reg.dnt:5000/tomcat:7",
  "network": "USER",
  "portMappings": [
    {
      "containerPort": 8080,
  "servicePort": 18080,
      "protocol": "tcp",
      "name": "tomcat",
      "labels": null
    }
  ],
  "parameters": [
    {
      "key": "ip",
      "value": "192.168.23.235"
    }
  ],
  "privileged": false,
  "forcePullImage": true
}
},
"healthChecks": [
{
  "protocol": "HTTP",
  "gracePeriodSeconds": 300,
  "intervalSeconds": 60,
  "timeoutSeconds": 20,
  "maxConsecutiveFailures": 3,
  "path": "/",
  "portIndex": 0
}
],
"env": {},
"labels": {}
}

tangjiaxing669 - Tom

赞同来自:


问题解决了

Brandon_Dong

赞同来自:


请问使用calico之后,A主机怎么连接B主机上面的docker?我的marathon也连接不上docker,楼主怎么实现的哈 求指导

要回复问题请先登录注册