使用kubectl时端口转发错误

问题描述 投票:0回答:1

我正在终端中运行命令

kubectl port-forward svc/egov-user 8080:8080 -n egov

这应该使 Web 服务器可以在我的

localhost:8080
中可访问的 pod 内运行。 但是当我向
localhost:8080
发出请求时,它不会返回任何内容并显示以下错误。

Handling connection for 8080
E0328 18:25:49.956533   48949 portforward.go:400] an error occurred forwarding 8080 -> 8080: error forwarding port 8080 to pod 7e969af36dc4ec6696936a7f052ef75c10e1c73425633c07b6bea37cd25e0441, uid : failed to execute portforward in network namespace "/var/run/netns/cni-005dc260-d493-5241-9f53-d58
3d0998a9c": failed to dial 8080: dial tcp4 127.0.0.1:8080: connect: connection refused

这是什么问题,我该如何解决?

我希望有一个网络服务器在连接到网络服务器的

localhost:8080
上运行。但我没有看到任何这样的事情正在运行。

kubernetes networking apache-kafka kubectl portforwarding
1个回答
0
投票

您可以尝试将端口转发到 Pod 本身吗? kubectl 端口转发 pod/POD_NAME 8080:8080 -n egov

© www.soinside.com 2019 - 2024. All rights reserved.