mesosphere-docker icon indicating copy to clipboard operation
mesosphere-docker copied to clipboard

Port Issue on Mesos Slave Container

Open virtualstaticvoid opened this issue 10 years ago • 5 comments

Hi @sekka1

Firstly, thanks for your article it has helped me get up and running real quick.

I've found an issue when running jobs which need a port open, such as a web server, where it is inaccessible as the port isn't exposed by the mesos slave container.

I tried changing the slave command to expose the range of ports, but I can't get it to work.

Also, I don't know where to find the configured range of ports that mesos (or marathon?) uses, so I guessed at 31000 to 32000.

 docker run -d \
 --entrypoint="mesos-slave" \
 --expose=31000-32000 \
 -e "MESOS_MASTER=zk://${HOST_IP}:2181/mesos" \
 -e "MESOS_LOG_DIR=/var/log/mesos" \
 -e "MESOS_LOGGING_LEVEL=INFO" \
 garland/mesosphere-docker-mesos-master:latest

Thanks

virtualstaticvoid avatar Jan 16 '15 10:01 virtualstaticvoid

Update: I figured out how to change the port range used, and expose them using the docker run command. In this example, I set the range from 31000 to 31050.

docker run -d \
           --entrypoint="mesos-slave" \
           --expose=31000-31050 \
           -P \
           -e "MESOS_MASTER=zk://${HOST_IP}:2181/mesos" \
           -e "MESOS_LOG_DIR=/var/log/mesos" \
           -e "MESOS_LOGGING_LEVEL=INFO" \
           garland/mesosphere-docker-mesos-master \
           --resources="ports(*):[31000-31050]"

virtualstaticvoid avatar Jan 17 '15 09:01 virtualstaticvoid

I'm having this same issue, the master can not task the slave.

malnick avatar Jul 01 '15 23:07 malnick

Same issue here.

mancvso avatar Jul 07 '15 18:07 mancvso

Same issue as well. I tried to expose the port range as @virtualstaticvoid suggested above; still does not appear to work properly, and it significantly clogs up the results of docker ps. The problem now is that no slaves at all appear in the main Mesos dashboard; previously, 1 "active" and 1 "deactivated" slave would appear. Any suggestions would be much appreciated.

magsol avatar Jul 08 '15 01:07 magsol

That took a little experimentation, but I found a configuration that seems to work.

For the zookeepers, I wrote this startup:

docker run -d \
    --net="host" \
    -p 2181:2181 \
    -e SERVER_ID=id \
    -e ADDITIONAL_ZOOKEEPER_1=server.1=1.1.1.1:2888:3888 \
    -e ADDITIONAL_ZOOKEEPER_2=server.2=2.2.2.2:2888:3888 \
    garland/zookeeper

I don't know if the -p line is absolutely necessary; haven't tested it yet.

The part I'm pretty sure is absolutely necessary is the modification I made to starting the container with mesos-slave:

docker run -d \
    --net="host" \
    -p 31000-31050:31000-31050 \
    --entrypoint="mesos-slave" \
    -e "MESOS_MASTER=zk://1.1.1.1:2181,2.2.2.2:2181/mesos" \
    -e "MESOS_LOG_DIR=/var/log/mesos" \
    -e "MESOS_LOGGING_LEVEL=INFO" \
    garland/mesosphere-docker-mesos-master:latest

Both slaves are visible in the Mesos dashboard, and I can successfully execute commands through Marathon.

The only problem I anticipate is that, evidently, running net="host" is a security concern. I was not able to find a way to make this work on separate nodes without setting the slave network configuration to host.

magsol avatar Jul 08 '15 19:07 magsol