如果我使用转发端口
kubectl port-forward mypod 9000:9000
Run Code Online (Sandbox Code Playgroud)
如何撤消,以便我可以将端口9000与另一个程序绑定?
此外,我如何测试以查看转发的端口?
Ale*_*son 33
该端口仅在kubectl进程运行时转发,因此您可以杀死转发端口的kubectl进程.在大多数情况下,这只是意味着在运行port-forward命令的终端中按CTRL + C.
fiz*_*max 19
如果它在后台运行,请考虑使用pkill
其名称来终止进程。例子:
pkill -f "port-forward"
Run Code Online (Sandbox Code Playgroud)
Doc*_*tor 17
如果它在后台启动,您可以使用该fg
命令访问它,然后使用ctrl + C
小智 10
$ ps -ef|grep port-forward
wyyl1 2013886 1 0 02:18 ? 00:00:10 kubectl port-forward svc/prometheus 9090:9090
wyyl1 2253978 2178606 0 07:58 pts/2 00:00:00 grep --color=auto port-forward
$ kill -9 2013886
Run Code Online (Sandbox Code Playgroud)
ps aux | grep -i kubectl | grep -v grep | awk {'print $2'} | xargs kill
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
13273 次 |
最近记录: |