Search code examples
dockermesosmarathon

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)


Solution

  • Others seem to have encountered this problem. Marathon is trying to allocate the same port twice. The solution is given in this comment on this github issue

    Rewritten for your scenario:

    You need to add the resource Port to mesos slave port range by adding the start parameter --resources-port=[4300-4300,31000-32000].

    Let me know if that works out for you.