Kubectl Port Forwarding issue

I am running a Prometheus exporter inside a container. To monitor the metrics, I am running the Prometheus on my host. The metric is pulled by Prometheus at (a.b.c.d:8081). I am using the following port forwarding command:

kubectl port-forward --address a.b.c.d podName 8081:8081 -n namespace

But I am getting the output as :
Forwarding from a.b.c.d:8081 → 8081
Handling connection for 8081
Handling connection for 8081
Handling connection for 8081
Handling connection for 8081
E1221 02:17:14.558250 104200 portforward.go:372] error copying from remote stream to local connection: readfrom tcp4 a.b.c.d:8081->a.b.c.d:49198: write tcp4 a.b.c.d:8081->a.b.c.d:49198: write: broken pipe
Handling connection for 8081
Handling connection for 8081
Handling connection for 8081
E1221 02:17:46.605283 104200 portforward.go:340] error creating error stream for port 8081 → 8081: Timeout occured
Handling connection for 8081
Handling connection for 8081
Handling connection for 8081
E1221 02:17:49.628599 104200 portforward.go:340] error creating error stream for port 8081 → 8081: Timeout occured
Handling connection for 8081
Handling connection for 8081
Handling connection for 8081
E1221 02:17:52.690064 104200 portforward.go:340] error creating error stream for port 8081 → 8081: Timeout occured
Handling connection for 8081
Handling connection for 8081
Handling connection for 8081
E1221 02:17:55.626256 104200 portforward.go:340] error creating error stream for port 8081 → 8081: Timeout occurred

Please help me with this.

1 Like

Related: