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

If two Services select the same pods then pods won't start #592

Closed
lkysow opened this issue Aug 7, 2021 · 7 comments · Fixed by #858
Closed

If two Services select the same pods then pods won't start #592

lkysow opened this issue Aug 7, 2021 · 7 comments · Fixed by #858
Assignees
Labels
type/bug Something isn't working

Comments

@lkysow
Copy link
Member

lkysow commented Aug 7, 2021

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request. Searching for pre-existing feature requests helps us consolidate datapoints for identical requirements into a single place, thank you!
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request.
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment.

Overview of the Issue

If two kube services have the same selector of mesh pods then Consul will register 4 service instances (two for each pod, sidecar and app) and then connect-init will loop forever because it's waiting for exactly 2 service instances.

Possible solutions

We can't register two service instances for one pod because the pod's sidecar can only receive traffic for one service name. So I think we need to provide a way to exclude one of the services from syncing. I checked and if you label the service, the labels are available at the endpoints level so we could do something basic like:

labels:
  consul.hashicorp.com/connect-ignore: true
@lkysow lkysow added the type/bug Something isn't working label Aug 7, 2021
@lkysow lkysow changed the title If two services select the same pods then pods won't start If two Services select the same pods then pods won't start Aug 20, 2021
@chauhanshubham
Copy link

Hello, any further updates on this? I'd like to implement it :)

@david-yu
Copy link
Contributor

@chauhanshubham Could you tell me more about why you would need this particular feature? In this case we are ignoring one of the services via a label. Are you also looking to deploy something like NGINX Ingress controller with Consul K8s sidecar proxies?

lawliet89 pushed a commit to lawliet89/consul-k8s that referenced this issue Sep 13, 2021
@chauhanshubham
Copy link

hi @david-yu i was just looking at it as a good first issue. Since the connect-init loop seems to get stuck in this scenario, I thought it should probably get fixed, irrespective of any specific usecases.

@mike-code
Copy link

@david-yu Actually I exactly have a case with nginx. My understanding is that having nginx with sidecar proxy is a valid scenario because otherwise I won't be able the to allow the nginx's loadbalancer service to communicate with applications that have sidecar proxies enabled.

Nginx deployment deploys two services nginx-controller and nginx-controller-admission (one being of type LoadBalancer and the other of ClusterIP) and both are bound to the same deployment. What would be the right way of dealing with such scenarios?

@david-yu
Copy link
Contributor

david-yu commented Dec 3, 2021

@mike-code We will be releasing the functionality that addresses this issue in our next release most likely around mid-December. Stay tuned!

@markharding
Copy link

@mike-code We will be releasing the functionality that addresses this issue in our next release most likely around mid-December. Stay tuned!

@david-yu any update on this?

@ishustava
Copy link
Member

Hey @markharding the fix for this was released, and you can now add the consul.hashicorp.com/service-ignore label to your service as mentioned in #858. If you are still running into issues using the latest release of the helm chart, please create a new issue and describe the steps for us to reproduce. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/bug Something isn't working
Projects
None yet
7 participants