I am confused with what all these port signify container port,host port and service port in portMappings, below is my json
"portMappings": [
{
"containerPort": 9000,
"hostPort": 9000,
"labels": {
"VIP_0": "/app2n:9000"
},
"protocol": "tcp",
"servicePort": 10101
}
]
containerPort
is the port in the container, one which your containerized app should listen on,hostPort
is the port which will be visible on the Mesos Agent where container is running,servicePort
is abstract port for internal use of framework, e.g. it can be used in loadbalancer as port mapped to host on which your run your container and its hostPort
. Should be unique across your cluster.Basically flow looks like this:
internet -> <loadbalancer e.g. nginx, haproxy>:<servicePort>
-> <mesos agent on which container runs>:<hostPort>
-> <container>:<containerPort>