kubefwd 不适用于特定端口/主机名
我正在使用此命令来运行 kubefwd (https://github.com/txn2/kubefwd)
<代码>sudo kubefwd services -x
这就是日志:
INFO[14:13:58] Port-Forward: 127.1.27.1 sbb-amq:8161 to pod sbb-amq-0:8161 INFO[14:13:58] Port-Forward: 127.1.27.1 sbb-amq:61616 to pod sbb-amq-0:61616 INFO[14:13:58] Port-Forward: 127.1.27.1 sbb-amq:61616 to pod sbb-amq-0:61616 INFO[14:13:58] Port-Forward: 127.1.27.7 idm:9006 to pod idm-0:9006 INFO[14:13:58] Port-Forward: 127.1.27.7 idm:80 to pod idm-0:9006 ERRO[14:14:01] ForwardPorts error: unable to listen on any of the requested ports: [{80 9006}]
我在日志的最后一行收到错误,所以我意识到与端口 80 和 9006 相关的所有主机名都不是附加到 IP,这意味着:
- http://idm:9006 不起作用
- http://127.1.27.7:9006 有效
但是:
- http://sbb-amq:8161 也有效(不使用端口 9006)
有人见过这个吗?
编辑:我使用的是 Ubuntu,端口 80/9006 未使用。
I am using this command to run kubefwd (https://github.com/txn2/kubefwd)
sudo kubefwd services -x <context> -n <namespace> -c <kube_file_path> -l "app in (idm, sbb-amq)"
That is the log:
INFO[14:13:58] Port-Forward: 127.1.27.1 sbb-amq:8161 to pod sbb-amq-0:8161 INFO[14:13:58] Port-Forward: 127.1.27.1 sbb-amq:61616 to pod sbb-amq-0:61616 INFO[14:13:58] Port-Forward: 127.1.27.1 sbb-amq:61616 to pod sbb-amq-0:61616 INFO[14:13:58] Port-Forward: 127.1.27.7 idm:9006 to pod idm-0:9006 INFO[14:13:58] Port-Forward: 127.1.27.7 idm:80 to pod idm-0:9006 ERRO[14:14:01] ForwardPorts error: unable to listen on any of the requested ports: [{80 9006}]
I got an error in the last line of the log, so I have realized that all the hostnames related to ports 80 and 9006 were not attached to the IP, which means:
- http://idm:9006 doesn't work
- http://127.1.27.7:9006 works
However:
- http://sbb-amq:8161 works as well (not using the port 9006)
Has anyone seen this before?
EDIT: I am using Ubuntu and the ports 80/9006 are not in use.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
无法侦听任何请求的端口
通常意味着您的本地工作站上有某些东西正在侦听这些端口,0.0.0.0:80
和0.0.0.0在本例中为:9006。 IP
0.0.0.0
表示它正在侦听所有接口上的这些端口。kubefwd
使用本地环回 IP 地址来允许多个服务使用同一端口,这样您就可以拥有127.27.1.1:80 -> someservice:80 和
127.27.1.2:80 ->某个其他服务:80
。不幸的是,当您的本地应用程序使用
0.0.0.0:80
时,您将无法将 80 绑定到任何接口,因为它已被使用。我不知道为什么应用程序经常绑定到每个接口,因为localhost
几乎总是指向127.0.0.1
。您有几个选择:
127.0.0.1
-m 80: 8080 -m 9006:9007
unable to listen on any of the requested ports
usually means that you have something on your local workstation listening on those ports,0.0.0.0:80
and0.0.0.0:9006
in this case. The IP0.0.0.0
means it's listening to those ports on all interfaces.kubefwd
uses local loopback IP addresses to allow the same port for multiple services so that you can have127.27.1.1:80 -> someservice:80
and127.27.1.2:80 -> someotherservice:80
.Unfortunately, when you have local applications using
0.0.0.0:80
, you will not be able to bind 80 to any interface, as it is already being used. I don't know why applications often bind to every interface sincelocalhost
almost always points to127.0.0.1
.You have a couple of options:
127.0.0.1
-m 80:8080 -m 9006:9007