K9s: Port forwarding: entering port manually

Created on 3 Jun 2019  路  6Comments  路  Source: derailed/k9s






Hey! First of all, thanks a lot for implementing #69!

Is your feature request related to a problem? Please describe.
I cannot port-forward to one of my pods. I would manually port forward as such (java remote debugging): kubectl port-forward <pod name> 5005:5005 but it seems like I can't freely fill in a port.

Furthermore, should I want to port forward to an exposed port to access my service, it doesn't seem to be working out either: No valid TCP port found on this container. I'm sure this is just a configuration issue on my end, but in my service resource I have this:

ports:
- name: https
  port: 443
  targetPort: 8080

Describe the solution you'd like
I'd like to be able to port forward to any port and if I could just press a button "do that port forward again" (I assume I already can in forward view) that would be GREAT :) (See port forwarding system of MobaXTerm)

Describe alternatives you've considered
Unacceptable manual labor with kubectl.

Additional context
Kubernetes cluster version: v1.13.5 (managed by Rancher)
k9s version: 0.7.2

enhancement question

Most helpful comment

@brentco Fixed 0.7.6!

All 6 comments

@brentco Thank you for this report! I am not sure I am getting all this. Can you refine?

What do you mean by I can't freely fill in a port? The port-forward dialog picks the first port available on the container by default but you can change it in the dialog?

Could you send your container port definition ie the one for target port 8080 so I can try to figure out what's going on with that port-forward?

@derailed Hey! So we don't really explicitly define exposed ports (except for in service resources). The dialog unfortunately does not appear if it can't find any defined ports for the container.

I would prefer it if it just let me fill in a port then. It should trust me! :) The kubectl port forward I described in the issue does work despite not having any explicit port definition.

@brentco Thank you for the clarification! Wow, I see. I am guessing then k8s just relies on the docker exposed ports? Just for my info, what is your incentive for not specifying the container's ports in the K8s manifests?

@derailed It's a production system and was set up this way. I don't have control over it and don't know why it wasn't done in the first place. I guess it wasn't necessary. As for how it works, I don't know either!

Apparently it's purely informational data:

List of ports to expose from the container. Exposing a port here gives the system additional information about the network connections a container uses, but is primarily informational. Not specifying a port here DOES NOT prevent that port from being exposed. Any port which is listening on the default "0.0.0.0" address inside a container will be accessible from the network. Cannot be updated.

https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.10/ --> Ports

@brentco Thanks for the update! Yikes. Sounds unnecessarily obscured. I feel for you should any of these docker images exposed ports changed ;(

@brentco Fixed 0.7.6!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

cdunford picture cdunford  路  3Comments

kordianbruck picture kordianbruck  路  3Comments

pgoodjohn picture pgoodjohn  路  4Comments

vasicvuk picture vasicvuk  路  3Comments

rahilb picture rahilb  路  3Comments