kubernetes中service中nodePort,port,targetPort含义 发表于 2019-12-02 | 分类于 技术 | 阅读次数: Service中经常遇到需要配置port的情况,一不小心就会搞迷糊我们在配置kubernetes的svc的时候,经常回遇到需要暴露端口的情况,需要非常清楚各个port代表的是什么意思。 12345678910111213141516171819202122kind: ServiceapiVersion: v1metadata: name: port-example-svcspec: # Make the service externally visible via the node type: NodePort ports: # Which port on the node is the service available through? # 在这个节点上, 可以通过哪个端口请求这个service - nodePort: 31234 # Inside the cluster, what port does the service expose? # 在集群里面, 这个svc暴露了哪个端口给别人调用 - port: 8080 # Which port do pods selected by this service expose? # 目标端口, 指的是这个svc暴露的是对应pods的哪个端口 - targetPort: selector: 本文作者: JohnnyWei 本文链接: https://smiled.me/2019/12/02/kubernetes-svc-port/ 版权声明: 本博客所有文章除特别声明外,均采用 CC BY-NC-SA 3.0 许可协议。转载请注明出处!