K8S查看某一个端口对应的service

1. 检查哪些服务使用了 30222 端口​

(1)查找 NodePort 类型的服务

kubectl get svc --all-namespaces -o wide | grep 30222
  • 如果 30222 是 NodePort,输出会显示类似:
  • namespace my-service NodePort 10.96.1.2 <none> 80:30222/TCP 1d

(2)检查服务的详细定义

kubectl describe svc -n <namespace> <my-service> | grep -i 30222
  • 确认 NodePort: 30222 是否属于该服务。
posted @ 2025-05-12 14:42  larybird  阅读(101)  评论(0)    收藏  举报