繁体   English   中英

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

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

我对所有这些端口在portMappings中表示容器端口,主机端口和服务端口感到困惑,以下是我的json

"portMappings": [
  {
    "containerPort": 9000,
    "hostPort": 9000,
    "labels": {
      "VIP_0": "/app2n:9000"
    },
    "protocol": "tcp",
    "servicePort": 10101
  }
]
  • containerPortcontainerPort中的端口,您的容器化应用应侦听该端口,
  • hostPort是在运行容器的Mesos代理上可见的端口,
  • servicePort是框架内部使用的抽象端口,例如,它可以在loadbalancer中用作映射到运行容器的主机及其hostPort端口。 在整个集群中应该是唯一的。

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

targetPort这是请求发送到的Pod上的端口。 您的应用程序需要在此端口上侦听网络请求才能使服务正常工作。 这些端口通常用于服务yaml描述符中。

暂无
暂无

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

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