gpt4 book ai didi

docker - 由于我们在配置服务时可以使用该选项,因此Kubernetes部署端口配置的用途是什么?

转载 作者:行者123 更新时间:2023-12-02 11:51:54 25 4
gpt4 key购买 nike

我们已经在Dockerfile中使用EXPOSE在docker上公开了一个端口,并再次使用porttargetPort在Kubernetes service.yaml中公开了一个端口;这些是可以理解的。但是,为什么需要在Kubernetes deployment.yaml上指定端口?我在这里缺少一些概念吗?

最佳答案

遵循Kubernetes文档here:

List of ports to expose from the container. Exposing a port here gives the system additional information about the network connections a container uses, but is primarily informational. Not specifying a port here DOES NOT prevent that port from being exposed. Any port which is listening on the default "0.0.0.0" address inside a container will be accessible from the network.



因此, ports中的 Deployment用于提供信息。它类似于Dockerfile中的 EXPOSE。主要原因是帮助维护部署的人员更好地了解配置。

关于docker - 由于我们在配置服务时可以使用该选项,因此Kubernetes部署端口配置的用途是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59297911/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com