首页 > 解决方案 > Marathon/Mesos - deploy application using the same host port for both UDP and TCP

问题描述

I tried to deploy an application using Marathon/Mesos. It has 2 server ports, 1 UDP and 1 TCP. I want to use the same port numbers for UDP and TCP. But it will not deploy it unless I use different ports. Any ideas?

"portMappings": [
  {
    "containerPort": 443,
    "hostPort": 4300,
    "servicePort": 10004,
    "protocol": "tcp",
    "labels": {}
  },
  {
    "containerPort": 162,
    "hostPort": 4300,
    "servicePort": 10005,
    "protocol": "udp",
    "labels": {}
  }
]

I'm seeing the following error:

2019-03-19T23:17:19.646760+00:00 controller marathon-services[4511]: [2019-03-19 23:17:19,645] INFO Acknowledge status update for task myserver-0.24a323d4-4a3d-11e9-83a5-054546b43537: TASK_ERROR (Resource 'ports:[4300-4300, 4300-4300]' is invalid: Invalid ranges resource: overlapping ranges) (mesosphere.marathon.core.task.update.impl.TaskStatusUpdateProcessorImpl$$EnhancerByGuice$$53f09936:ForkJoinPool-2-worker-31)

标签: dockermesosmarathon

解决方案


其他人似乎也遇到过这个问题。Marathon 试图两次分配同一个端口。解决方案在此 github 问题的评论中给出

为您的场景重写:

您需要通过添加 start 参数将资源端口添加到 mesos 从端口范围--resources-port=[4300-4300,31000-32000]

让我知道这是否适合你。


推荐阅读