Functionality for Keeping Forwarded Ports Open and Monitoring Health
Is your feature request related to a problem? Please describe. I often find that while working with Kubernetes and using the k9s (kubectl) port-forward function, the connection seems to drop after a few minutes of idling. This is quite inconvenient, as I have to manually reestablish the connection, disrupting the workflow and making it less efficient. An example of the issue can be seen below: https://stackoverflow.com/questions/47484312/kubectl-port-forwarding-timeout-issue
Describe the solution you'd like To address this, I propose a new feature within k9s: a function that keeps the specified forwarded ports open and concurrently monitors their health. This function would periodically "ping" these ports (as outlined in this StackOverflow answer: kubectl port-forwarding timeout issue) every 10 seconds to prevent them from idling and closing. This feature would not only ensure that the forwarded ports remain open and accessible but also provide real-time updates about their status. This would facilitate quick detection and resolution of any connectivity issues, significantly improving the workflow for many k9s users.
Describe alternatives you've considered As a current workaround, I have developed a supplementary k8s utility that enables me to pass a list of ports that I wish to keep open. You can find this utility at anatoly-cnvrg/zsh_scripts. However, integrating this functionality directly into k9s would provide a smoother, more seamless user experience.
Additional context Some primary considerations regarding this feature proposal include its relevance and feasibility. I'm interested in gauging community interest and need for such a feature within the k9s project. The method of implementation also warrants discussion; should this be a default feature, an optional toggle available when forwarding ports, or perhaps be developed as a separate plugin? Your thoughts and perspectives would greatly contribute to these deliberations.
@anatoly-cnvrg Thank you for this great writing!
I need to noodle on this some... For my use case I typically setup forwards when I need to use them right away. Not sure if keeping them alive for the entire k9s session duration makes sense. Moreover with k9s auto-forward feature establishing connections if pretty easy as one can establish a pf in a single command.
I'm also experiencing the same behavior, and it's frustrating
I open k9s, perform a port forwarding, not even go for a cup of tea, I come back to see the port forwarding closed in the system but having k9s still report that is alive.
The one I have right now shows AGE 14mins. What are the settings? I can tell you, it looks like a bug as the disconnection does not seem consistent.
It does make sense to keep them on for the entire session. When performing directly with kubectl, that is the experience, it will stay on until cancelled.
Can you tell me where we can read about the auto-forward feature?
Thank you
Yes, I am dealing with the same thing! I can't get my port forwards to be stable lately.