我如何在一个端口号上更改 运行ning 服务,现在我想 运行 同一旧端口号上的另一项服务

How can i change a service running on one port number, now i want to run another service on same old port number

我正在使用部署 yaml 文件 ex:nginx,我正在使用端口 30080。 现在我写了另一个部署 yaml 文件,但我想使用端口号 30080。

The Service "web" is invalid: spec.ports[0].nodePort: Invalid value: 30080: >provided port is already allocated

如何将端口号 30080 用于我的新部署 web.yaml 文件。 1) 删除了 nginx pod 运行。 2)删除nginx部署运行.

But how can i free up the port number 30080.

我检查了端口号:

sudo iptables-save | grep 30080

-A KUBE-EXTERNAL-SERVICES -p tcp -m comment --comment "default/nginx-service: has no endpoints" -m addrtype --dst-type LOCAL -m tcp --dport 30080 -j REJECT --reject-with icmp-
port-unreachable 

我删除了部署和 pod。但是我忘记了服务是 运行 删除 nginx 服务后我可以将端口号 30080 重新用于其他部署。

socket.error: [Errno 48] Address already in use

这个问题也对我有帮助,但它指向杀死那个进程,这里的进程 运行 是 kube-proxy。

sudo lsof -i:30080

COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME kube-prox 3320 root 8u IPv6 40388 0t0 TCP *:30080 (LISTEN)

我不能 delete.It 删除 kube-prox 可能会产生问题

请告诉我这是否是正确的方法。