简体   繁体   English

portMappings中dcos json中的容器端口,主机端口和服务端口之间的区别

[英]Difference between container port,host port and service port in dcos json in portMappings

I am confused with what all these port signify container port,host port and service port in portMappings, below is my json 我对所有这些端口在portMappings中表示容器端口,主机端口和服务端口感到困惑,以下是我的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, containerPortcontainerPort中的端口,您的容器化应用应侦听该端口,
  • hostPort is the port which will be visible on the Mesos Agent where container is running, hostPort是在运行容器的Mesos代理上可见的端口,
  • servicePort is abstract port for internal use of framework, eg it can be used in loadbalancer as port mapped to host on which your run your container and its hostPort . servicePort是框架内部使用的抽象端口,例如,它可以在loadbalancer中用作映射到运行容器的主机及其hostPort端口。 Should be unique across your cluster. 在整个集群中应该是唯一的。

Basically flow looks like this: internet -> <loadbalancer eg nginx, haproxy>:<servicePort> -> <mesos agent on which container runs>:<hostPort> -> <container>:<containerPort> 基本上流看起来像这样:互联网-> <loadbalancer eg nginx, haproxy>:<servicePort> -> <mesos agent on which container runs>:<hostPort> -> <container>:<containerPort>

A targetPort This is the port on the pod that the request gets sent to. targetPort这是请求发送到的Pod上的端口。 Your application needs to be listening for network requests on this port for the service to work. 您的应用程序需要在此端口上侦听网络请求才能使服务正常工作。 These ports are typically used in service yaml descriptors. 这些端口通常用于服务yaml描述符中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM