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
Provide a base port option #24
Comments
There should not be a need to use different ports than the ones specified in the service. The idea is that kubefwd allows you to connect to services with the same url as you would in the cluster. This sounds like a bug, but I need steps to reproduce. My only experience with this error "unable to listen on any of the requested ports" is when there is no pod attached to the service or the pod is not functioning properly (Crashing/etc). Are you sure your pod is accessible from the service? |
When I stop the first instance and run kubefwd again, it suceeds without those messages:
When the other instance is running, I see the following output:
|
@mrumpf from your examples it looks like you are trying to run two instances of kubefwd at the same time, which is not really a use case I intended. Also, it seems like you are trying to forward the same services on the on the same namespace and cluster. I think I need to better understand what you are trying to accomplish. |
The use-case is simple. I'm working on a project where microservices are distributed over 4 different Kubernetes clusters and I need to connect to multiple Kubernetes clusters at the same time. I start kubefwd on the first cluster:
Then I want to start the second kubefwd instance against another cluster:
This one fails, because it tries to open port 80 for the second time in the IP range 127.1.27.x (BTW, it would be great to show on which IP the port cannot be opened in the message "fw.ForwardPorts Error: unable to listen on any of the requested ports: [{80 80}]") One idea is to use a different localhost network IP range for each instance?
Instead of trying to determine whether there is another instance running, a property
would be great to tell kubefwd just to use other IPs for the second instance
The modification of the the /etc/hosts file should not be affected by multiple instances. |
It would be easier for me to allow kubefwd to use multiple contexts, it would not work well to have multiple instances running since there could easily be race conditions when managing IPs and hostnames. kubefwd does increment the IP addresses now and it works well with multiple namespaces. I see too many problems trying to support multiple instances running and not conflicting with each other. If multiple clusters are needed then it would probably need to work like the multiple namespaces, the first cluster would work as it does now, then additional clusters could only be accessed through |
You are right, passing multiple contexts would allow you to avoid any naming or port conflicts. And yes, something like So the /etc/hosts could look like this (in my case from above):
That means, connecting to a single cluster would allow the same naming pattern as today, so no change for existing users. When you specify multiple contexts, the naming rules are different to avoid conflicts. |
I am closing this issue and referring to it in a new enhancement issue #28 for supporting multiple clusters. |
When I want to forward to services in multiple clusters or namespaces, which use the same ports, e.g. port 80, kubefwd reports the following error:
An option to specify a port offset "--baseport=30000" and map all ports to consecutive port numbers would be great to allow working with different clusters at the same time.
The text was updated successfully, but these errors were encountered: