集装箱港口吊舱与集装箱港口服务 [英] Container port pods vs container port service

查看:57
本文介绍了集装箱港口吊舱与集装箱港口服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想了解服务端口和pod容器端口之间的映射.

I would like to understand the mapping between the service port and pod container port.

我是否需要将容器端口定义为Pod的一部分以及服务的一部分?还是将其作为服务的一部分公开是可以的吗?

Do I need to define the container port as part of my pod and also as part of my service? Or it's ok just to expose it as part of the service?

推荐答案

containerPort作为pod定义的一部分仅用于提供信息.最终,如果要将其作为服务公开到群集或节点中,则必须创建一个服务.

containerPort as part of the pod definition is only informational purposes. Ultimately if you want to expose this as a service within the cluster or node then you have to create a service.

要回答您的问题,是的,只要将其作为Kubernetes服务的一部分公开即可.最好将其作为Pod定义的一部分提及,这样,如果有人查看该定义,便可以了解您的容器服务正在运行的端口.

To answer your question, yes it is enough if you just expose it as part of the Kubernetes service. It is a good practice to mention as part of the pod definition so that if someone looks at the definition can understand the port where your container service is running.

此处-

这篇关于集装箱港口吊舱与集装箱港口服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆