Giter Club home page Giter Club logo

Comments (11)

graemerocher avatar graemerocher commented on June 12, 2024

Probably doable

from micronaut-kubernetes.

alvarosanchez avatar alvarosanchez commented on June 12, 2024

To be precise, what the current implementation uses is the EndpointsSubset.addresses. Quoting Kubernetes documentation:

IP addresses which offer the related ports that are marked as ready. These endpoints should be considered safe for load balancers and clients to utilize

The reason to not use the Service.clusterIP is consistency: all Micronaut service discovery implementations use Micronaut's load balancing capabilities.

So in this case, the issue is really an outdated service list, and therefore, implementing #186 by watching endpoints changes will fix this issue.

from micronaut-kubernetes.

luckyswede avatar luckyswede commented on June 12, 2024

@alvarosanchez We did not have caching enabled when we encountered the problem with unavailable pods in the service list. So from what I understand the discovery-client refreshed the service list on each request. One pod was unavailable nonetheless. Maybe the k8s api server state was not propagated fast enough, I dont know.
At the same time we had Micronaut 1.2.x-based apps that used the same service (with a failing pod) via the cluster-ip, and those apps experienced much fewer issues. 15 instances of 1.2-based apps had about 500 connection errors in total, at the same time a single 2.0.2 based canary app had connection 2000 errors. The traffic was evenly distributed over those 16 instances.

from micronaut-kubernetes.

alvarosanchez avatar alvarosanchez commented on June 12, 2024

If you really want to use the cluster IP, you can use the records created by kube-dns, eg:

@Client("my-service.my-namespace.svc.cluster.local")

from micronaut-kubernetes.

graemerocher avatar graemerocher commented on June 12, 2024

@alvarosanchez maybe worth documenting that somewhere if that is viable fix. @luckyswede does that work for you?

from micronaut-kubernetes.

graemerocher avatar graemerocher commented on June 12, 2024

also does that need to be in ${..}?

from micronaut-kubernetes.

luckyswede avatar luckyswede commented on June 12, 2024

Yes, we're going for a similar solution, we've implemented a discovery-client that creates a k8s service-url from the service-id. It's more "plug-n-play", we dont have to change the client annotations or add config entries.

from micronaut-kubernetes.

luckyswede avatar luckyswede commented on June 12, 2024

@graemerocher a related question, what is the contract for DiscoveryClient.getServiceIds? Is it supposed to return all service-ids that it has "seen" in requests to getInstances? Or a list of all service-ids it supports (which is not possible if the service-instance is calculated from the service-id)?

from micronaut-kubernetes.

alvarosanchez avatar alvarosanchez commented on June 12, 2024

also does that need to be in ${..}?

No, it doesn't. Given a service my-service in a namespace my-namespace, my-service.my-namespace.svc.cluster.local will be a DNS A record that will resolve to the service cluster IP.

But I did miss the rest of the URL, so it should be something like:

@Client("http://my-service.my-namespace.svc.cluster.local:8080")

from micronaut-kubernetes.

stale avatar stale commented on June 12, 2024

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

from micronaut-kubernetes.

pgressa avatar pgressa commented on June 12, 2024

addressed in #215

from micronaut-kubernetes.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.