-
Notifications
You must be signed in to change notification settings - Fork 205
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support port-mapping when forwarding #121
Comments
I am not completely against the idea however it does go against
|
One of the key things that ends up listening on port 80 on my work laptop is [BranchCache](https://docs.microsoft.com/en-us/windows-server/networking/branchcache/branchcache)
which I can't change due to Group Policy. You're right that it must listen on all interfaces, but I can't change that.
Given that Kubernetes is something that most people will be using in their work life rather than their personal life, and many people are using Windows with these sorts of Enterprise features, I imagine a number of people have the same problem.
I think the default should obviously stay with the current behaviour of reusing the service ports, but having the option of remapping would solve
those problems.
|
I am not opposed to your feature request, however, I think it could cause confusion if not implemented clearly, Many people use You might want to try using the Docker container, I know a few people who use it in environments where they don't have superuser access (low ports, etc)... As for implementation... maybe forwarding maps like
BTW there are plenty of enterprises that don't make things like this a PIA for their developers. :) |
Ha, yeah tell me about it 😂
It would be nice if the port mapping was the same way round as kubectl just to aid usability, so local:remote instead of remote:local. If the same flag could be used as well (-p) then even better.
I much prefer kubefwd to managing my own kubectl for quite a few reasons (automatic hosts changing, automatically re-establishing connections, a single command/shell to manage) because it's a really great tool. This one final feature would make it absolutely perfect for my use case.
|
@adamrodger you are correct regarding the order. I fixed my comment. Not sure how soon I'll be able to work on this but I see now how it could be helpful in situations like yours. |
Thanks very much. I'll look forward to it. |
You can add another port on the service for port 8080 that uses the same target port on the pod. It seems a bit hackish but it's not too bad and it gets the job done. Or even add another entire service for this purpose if need be. |
I think I'd prefer specifying the -p flag multiple times instead of a comma
separated string with a special format. That matches general CLI
conventions. So like:
kubefwd svc -p 80:8080 -p 443:1443
…On Sat, 6 Mar 2021, 03:40 ndj888, ***@***.***> wrote:
Add port forwarding batch mapping.
ex:
kubefwd svc -n the-project -p "8080:80,3309:3306"
kubefwd svc -n the-project -p "8080:80"
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#121 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAD4FKX5DQZGNX5DODGKZ4LTCGP4TANCNFSM4NFYJ4FQ>
.
|
I am thinking that "p" might not be a great choice, maybe "m" or something like that. I don't fully understand the use-case since
I understand there is a use case where you have some software that listens on all interfaces, such as I am ok with the new functionality if we using something other than also agree with @adamrodger I think it should be something like |
That's a good suggestion. To this end I submitted a new pull request. |
@ndj888 thanks for work on this. see https://github.com/txn2/kubefwd/releases/tag/1.18.0 |
With a manual
kubectl
port forward you can map a local port to a different service port, like this:It would be great if
kubefwd
could support this also but I can't see a current option to do that. I frequently need to forward to pods on port 80 but also have something running locally on port 80 (e.g. running a web UI locally but forwarding to APIs on a cluster).I don't think we need per-service mapping rules or anything, just a blanket "any service found using port X will be forwarded from local port Y", like:
Unfortunately I don't know Go otherwise I'd try and implement that myself.
The text was updated successfully, but these errors were encountered: