为什么NodePort类型的service在 node节点上 netstat看不到其nodeport端口?-灵析社区

开挂思想家

![image.png](https://wmprod.oss-cn-shanghai.aliyuncs.com/c/user/20241001/3f9d3024a2644bf24448e9838de65a80.png) ![image.png](https://wmprod.oss-cn-shanghai.aliyuncs.com/c/user/20241001/d3517e5186ff10034e3317c8243b73ce.png) NodePort类型的service 的nodePort为31002 apiVersion: v1 kind: Service metadata: name: tomcat-service spec: type: NodePort ports: - port: 8080 nodePort: 31002 selector: tier: frontend 问题: 虽然curl localhost:31002 能返回html数据,但是为什么 netstat -tlp |grep 31002 没有数据?

阅读量:134

点赞量:0

问AI
怼怼事务所
这个端口是通过 iptable 规则转发到实际的服务 pod ip/端口 上去的,并没有一个进程在这个端口上监听。所以 netstat 自然就看不到。