kind: fails to use port-forward with kind in githubaction

Hi, I wanna to use kind as k8s cluster and deploy my service on it. then I am moving forward with port-forward and try to use localhost port to test it. but I received error as failed to connect to localhost:9102 inside namespace

Handling connection for 9102
E1004 08:02:47.046060    7990 portforward.go:406] an error occurred forwarding 9102 -> 9102: error forwarding port 9102 to pod 2b02221f9f4b01c499fabccd3d35d62e5591d6b1303d9[18](https://github.com/sustainable-computing-io/kepler/actions/runs/3180383090/jobs/5183888088#step:7:19)294587bd80d23e38f, uid : failed to execute portforward in network namespace "host": failed to connect to localhost:9102 inside namespace "2b022[21](https://github.com/sustainable-computing-io/kepler/actions/runs/3180383090/jobs/5183888088#step:7:22)f9f4b01c499fabccd3d35d62e5591d6b1303d918294587bd80d[23](https://github.com/sustainable-computing-io/kepler/actions/runs/3180383090/jobs/5183888088#step:7:24)e38f", IPv4: dial tcp4 1[27](https://github.com/sustainable-computing-io/kepler/actions/runs/3180383090/jobs/5183888088#step:7:28).0.0.1:9102: connect: connection refused IPv6 dial tcp6 [::1]:9102: connect: connection refused 
E1004 08:02:47.047407    7990 portforward.go:2[34](https://github.com/sustainable-computing-io/kepler/actions/runs/3180383090/jobs/5183888088#step:7:35)] lost connection to pod

ref https://github.com/sustainable-computing-io/kepler/pull/275 full log:

I1004 08:02:09.044762    7990 loader.go:374] Config loaded from file:  /home/runner/.kube/config
I1004 0[8](https://github.com/sustainable-computing-io/kepler/actions/runs/3180383090/jobs/5183888088#step:7:9):02:09.054192    7990 round_trippers.go:463] GET https://127.0.0.1:37749/api/v1/namespaces/kepler/services/kepler-exporter
I1004 08:02:0[9](https://github.com/sustainable-computing-io/kepler/actions/runs/3180383090/jobs/5183888088#step:7:10).054211    7990 round_trippers.go:469] Request Headers:
I[10](https://github.com/sustainable-computing-io/kepler/actions/runs/3180383090/jobs/5183888088#step:7:11)04 08:02:09.054220    7990 round_trippers.go:473]     Accept: application/json, */*
I1004 08:02:09.054227    7990 round_trippers.go:473]     User-Agent: kubectl/v1.25.2 (linux/amd64) kubernetes/5835544
I1004 08:02:09.062814    7990 round_trippers.go:574] Response Status: 200 OK in 8 milliseconds
I1004 08:02:09.179931    7990 round_trippers.go:463] GET https://127.0.0.1:37749/api/v1/namespaces/kepler/pods?labelSelector=app.kubernetes.io%2Fcomponent%3Dexporter%2Capp.kubernetes.io%2Fname%3Dkepler-exporter
I1004 08:02:09.179956    7990 round_trippers.go:469] Request Headers:
I1004 08:02:09.179965    7990 round_trippers.go:473]     Accept: application/json, */*
I1004 08:02:09.179972    7990 round_trippers.go:473]     User-Agent: kubectl/v1.25.2 (linux/amd64) kubernetes/5835544
I1004 08:02:09.182492    7990 round_trippers.go:574] Response Status: 200 OK in 2 milliseconds
I1004 08:02:09.85[11](https://github.com/sustainable-computing-io/kepler/actions/runs/3180383090/jobs/5183888088#step:7:12)24    7990 round_trippers.go:463] GET https://[12](https://github.com/sustainable-computing-io/kepler/actions/runs/3180383090/jobs/5183888088#step:7:13)7.0.0.1:37749/api/v1/namespaces/kepler/pods/kepler-exporter-9xmzm
I1004 08:02:09.85[13](https://github.com/sustainable-computing-io/kepler/actions/runs/3180383090/jobs/5183888088#step:7:14)83    7990 round_trippers.go:469] Request Headers:
I1004 08:02:09.85[16](https://github.com/sustainable-computing-io/kepler/actions/runs/3180383090/jobs/5183888088#step:7:17)10    7990 round_trippers.go:473]     Accept: application/json, */*
I1004 08:02:09.851625    7990 round_trippers.go:473]     User-Agent: kubectl/v1.25.2 (linux/amd64) kubernetes/5835544
I1004 08:02:09.853849    7990 round_trippers.go:574] Response Status: 200 OK in 2 milliseconds
I1004 08:02:09.855082    7990 round_trippers.go:463] POST https://127.0.0.1:37749/api/v1/namespaces/kepler/pods/kepler-exporter-9xmzm/portforward
I1004 08:02:09.855098    7990 round_trippers.go:469] Request Headers:
I1004 08:02:09.855106    7990 round_trippers.go:473]     X-Stream-Protocol-Version: portforward.k8s.io
I1004 08:02:09.855113    7990 round_trippers.go:473]     User-Agent: kubectl/v1.25.2 (linux/amd64) kubernetes/5835544
I1004 08:02:09.924785    7990 round_trippers.go:574] Response Status: 101 Switching Protocols in 69 milliseconds
Forwarding from 127.0.0.1:9102 -> 9102
Forwarding from [::1]:9102 -> 9102
Running Suite: E2eTest Suite
============================
Random Seed: 1664870545
Will run 1 of 1 specs

Handling connection for 9102
E1004 08:02:47.046060    7990 portforward.go:406] an error occurred forwarding 9102 -> 9102: error forwarding port 9102 to pod 2b02221f9f4b01c499fabccd3d35d62e5591d6b1303d9[18](https://github.com/sustainable-computing-io/kepler/actions/runs/3180383090/jobs/5183888088#step:7:19)294587bd80d23e38f, uid : failed to execute portforward in network namespace "host": failed to connect to localhost:9102 inside namespace "2b022[21](https://github.com/sustainable-computing-io/kepler/actions/runs/3180383090/jobs/5183888088#step:7:22)f9f4b01c499fabccd3d35d62e5591d6b1303d918294587bd80d[23](https://github.com/sustainable-computing-io/kepler/actions/runs/3180383090/jobs/5183888088#step:7:24)e38f", IPv4: dial tcp4 1[27](https://github.com/sustainable-computing-io/kepler/actions/runs/3180383090/jobs/5183888088#step:7:28).0.0.1:9102: connect: connection refused IPv6 dial tcp6 [::1]:9102: connect: connection refused 
E1004 08:02:47.047407    7990 portforward.go:2[34](https://github.com/sustainable-computing-io/kepler/actions/runs/3180383090/jobs/5183888088#step:7:35)] lost connection to pod

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 17 (8 by maintainers)

Most upvoted comments

So far @aojea is right, we found a panic in our code logic and we are WIP for fix.