-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Closed
Labels
bugSomething isn't workingSomething isn't workingin-progressMark issue as being worked onMark issue as being worked on
Description
Describe the bug
When I create a port forward to the wrong port, the port forward gets deleted without a UI notification. The error message in the log is not expressive.
When creating the port forward on a service, rather than on a pod, and the service exposes a different port than the pod does, it's easy to run into that issue, see below.
To Reproduce
kubectl run nginx --image nginx
- In k9s, use Shift+F to create a port forward
- Enter
81
as container and local ports curl --verbose 'http://127.0.0.1:81/'
* Trying 127.0.0.1:81...
* Connected to 127.0.0.1 (127.0.0.1) port 81
* using HTTP/1.x
> GET / HTTP/1.1
> Host: 127.0.0.1:81
> User-Agent: curl/8.11.1
> Accept: */*
>
* Recv failure: Connection was aborted
* closing connection #0
curl: (56) Recv failure: Connection was aborted
- See the port forward getting deleted without notification.
- Find error message in k9s.log:
Flash failed error="lost connection to pod"
Deleted portforward count=1 gvr=nginx||81:81
Expected behavior
- UI message stating that the port forward was deleted, potentially giving a possible reason.
- Expressive message in the log.
Versions:
- OS: Windows 11
- K9s: 0.50.4
- K8s: 1.32.2
Additional context
I ran into this issue trying to connect to a service, which exposes port 80 and has targetPort
8080. I used port 80 in k9s as I did with kubectl:
kubectl port-forward svc/myservice 80:80
While kubectl forwards to 8080, k9s suggests 8080 but lets you enter any port, 80
in my case.
I didn't notice the pod's port in the kubectl output:
Forwarding from 127.0.0.1:80 -> 8080
Forwarding from [::1]:80 -> 8080
That's how I got stuck with the connection failing with k9s.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingin-progressMark issue as being worked onMark issue as being worked on