kubectl port-forward

支洋
2023-12-01

 今天遇到了一个问题,当我kubectl port-forward映射到本地的时候我control+z了,正常应该是control+c,找了不少资料 后来查了下control+z和control+c的区别得出结论 哈哈哈

opay1@OPay-20210101 1.15.2 % kubectl port-forward service/flink-feature-merchant-monitor-rest 8081
Forwarding from 127.0.0.1:8081 -> 8081
Forwarding from [::1]:8081 -> 8081
Handling connection for 8081
Handling connection for 8081
Handling connection for 8081
Handling connection for 8081
Handling connection for 8081
Handling connection for 8081
Handling connection for 8081
Handling connection for 8081
^Z
zsh: suspended  kubectl port-forward service/flink-feature-merchant-monitor-rest 8081
------------以下是我想再次启动的时候出现的情况------------------
opay1@OPay-20210101 1.15.2 % kubectl port-forward service/flink-feature-monitor-rest 8081
Unable to listen on port 8081: Listeners failed to create with the following errors: [unable to create listener: Error listen tcp4 127.0.0.1:8081: bind: address already in use unable to create listener: Error listen tcp6 [::1]:8081: bind: address already in use]
error: unable to listen on any of the requested ports: [{8081 8081}]
-----------以下是我通过jobs命令查到的服务,我的服务[7]被挂起了,通过fg %7 然后再次映射就ok了
opay1@OPay-20210101 1.15.2 % jobs
[1]    suspended  kubectl get pods
[2]    suspended  ping 10.66.0.239
[3]    suspended  kubectl get pods
[4]    suspended  kubectl get pods
[5]    suspended  kubectl get pods
[6]  - suspended  kubectl get pods
[7]  + suspended  kubectl port-forward service/flink-feature-merchant-monitor-rest 8081
opay1@OPay-20210101 1.15.2 % fg %7
[7]    continued  kubectl port-forward service/flink-feature-merchant-monitor-rest 8081
zsh: terminated  kubectl port-forward service/flink-feature-merchant-monitor-rest 8081
opay1@OPay-20210101 1.15.2 % kubectl port-forward service/flink-feature-merchant-monitor-rest 8081
Forwarding from 127.0.0.1:8081 -> 8081
Forwarding from [::1]:8081 -> 8081
Handling connection for 8081
Handling connection for 8081
Handling connection for 8081
Handling connection for 8081

------------以下是我想再次启动的时候出现的情况------------------
opay1@OPay-20210101 1.15.2 % kubectl port-forward service/flink-feature-monitor-rest 8081
Unable to listen on port 8081: Listeners failed to create with the following errors: [unable to create listener: Error listen tcp4 127.0.0.1:8081: bind: address already in use unable to create listener: Error listen tcp6 [::1]:8081: bind: address already in use]
error: unable to listen on any of the requested ports: [{8081 8081}]
-----------以下是我通过jobs命令查到的服务,我的服务[7]被挂起了,通过fg %7 然后再次映射就ok了
opay1@OPay-20210101 1.15.2 % jobs
[1]    suspended  kubectl get pods
[2]    suspended  ping 10.66.0.239
[3]    suspended  kubectl get pods
[4]    suspended  kubectl get pods
[5]    suspended  kubectl get pods
[6]  - suspended  kubectl get pods
[7]  + suspended  kubectl port-forward service/flink-feature-merchant-monitor-rest 8081
opay1@OPay-20210101 1.15.2 % fg %7
[7]    continued  kubectl port-forward service/flink-feature-merchant-monitor-rest 8081
zsh: terminated  kubectl port-forward service/flink-feature-merchant-monitor-rest 8081
opay1@OPay-20210101 1.15.2 % kubectl port-forward service/flink-feature-merchant-monitor-rest 8081
Forwarding from 127.0.0.1:8081 -> 8081
Forwarding from [::1]:8081 -> 8081
Handling connection for 8081
Handling connection for 8081
Handling connection for 8081
Handling connection for 8081

 类似资料: