Skip to content
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

Pod names are used instead of service names #71

Closed
Gerrit-K opened this issue Aug 8, 2019 · 9 comments
Closed

Pod names are used instead of service names #71

Gerrit-K opened this issue Aug 8, 2019 · 9 comments

Comments

@Gerrit-K
Copy link

Gerrit-K commented Aug 8, 2019

tl;dr
Since version 1.8.2 kubefwd uses the pod names instead of the service names as hostnames


I used to use kubefwd 1.8.0 a lot for local development and embedded the service names in configs, e.g. the redis service oy my app acme for the feature featxy was forwarded according to the service name featxy-acme-redis. Since upgrading to 1.8.4 (actually since 1.8.2 and later) /etc/hosts is populated with the pod names instead (e.g. featxy-acme-redis-57cbcdbd98) which forces me to change all the configs if the pod gets a new identifier. Is this a bug or a feature?

@cjimti
Copy link
Member

cjimti commented Aug 8, 2019

If I remember correcly it was the result of a PR to fix headless services. I will look into this.

@cjimti cjimti closed this as completed in aa66c0a Aug 8, 2019
@Gerrit-K
Copy link
Author

Gerrit-K commented Aug 9, 2019

Thanks for the quick resolution!

@Gerrit-K
Copy link
Author

Gerrit-K commented Nov 19, 2019

@cjimti Sorry for digging this up again, but this issue seems to have reappeared. I'm using 1.9.7 and kubefwd only forwards the pod names (including the suffix) as host names again.

Edit: just tested with 1.9.6 and it works. I guess that's due to #93 ?

@cjimti
Copy link
Member

cjimti commented Nov 21, 2019

@Gerrit-K thanks for bringing this up. @calmkart, any chance you can help with this regression in #93 ? Thanks

I am at KubeCon this week so limited in my availability and then on vacation next week.

@cjimti cjimti reopened this Nov 21, 2019
@calmkart
Copy link
Contributor

calmkart commented Nov 21, 2019

@Gerrit-K @cjimti
From my logic, the headless service should not be represented only by the first pod. So the service name accessing the headless service should not be forwarded to his first pod.
The current logic is:

  1. The normal service forwards its first pod to the service name (nginx), and we can access the first pod (nginx-deployment-5cdfb5fc49-b44j2) by accessing the service name(nginx)

  2. Headless service forwards all pods (similar to this: nginx-deployment-5cdfb5fc49-b44j2.nginx1; nginx-deployment-5cdfb5fc49-dfhvs.nginx1) but does not forward the service name (nginx1), we access the headless service name (nginx1) Unable to access any pods.

Is it correct and necessary to automatically forward its first pod as a service name for a headless service? (Accessing nginx1 means accessing nginx-deployment-5cdfb5fc49-b44j2.nginx1)

I will make changes if necessary. Looking forward to the reply.

@cjimti
Copy link
Member

cjimti commented Nov 21, 2019

@calmkart yes to support 12-factor style development. When developing software locally the application may wish to point to a headless service (such as cassandra-client:9180,) since /etc/hosts is not DNS we need to point any headless service to the first Pod it finds.

However, we also need to continue forwarding the individual Pods backing a headless service to be as flexible as possible.

@calmkart
Copy link
Contributor

@cjimti
fixed in commit
for pr #95

@cjimti
Copy link
Member

cjimti commented Nov 22, 2019

@Gerrit-K I have reverted back to 1.9.6 and released it again as 1.10.0. This solved the problem for me as well as keeping @calmkart's performance updates.

@cjimti cjimti closed this as completed Nov 22, 2019
@Gerrit-K
Copy link
Author

Gerrit-K commented Dec 2, 2019

Sorry for the late response and thanks to both of you for revisiting and fixing this!

D3-LucaPiombino pushed a commit to CodeCoil/kubefwd that referenced this issue Jun 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants