Comments (10)
I think you would have the same issue even if you use deployment, new pods would crash-loop anyways.
The way how we solved this is: we have our own implementation of the Kubernetes strategy that polls k8s API and only joins nodes of the same version (from the version label) into a cluster. This makes it impossible to handoff state between application versions but makes sure that code that was never tested to co-live in a cluster would end up crashing in production.
from libcluster.
@AndrewDryga do you think this custom k8s strategy is worth a PR or can be shared ? Because i feel like how are more people not running into this same issue ? Is everyone else using this library only every deploying libcluster 1 time and then never adding new features into its registry from that point forward ?
from libcluster.
@amacciola the problem with our strategy is that it is very opinionated (uses specific labels named for our environment, uses node names from k8s labels, etc). I will think about open-sourcing it but it's a relatively easy change: just leverage labelSelector
in get_nodes/4
callback implementation and query only the pods of a specific version.
from libcluster.
@AndrewDryga okay i will try this. So if i am trying to extend the k8s dns strategy here:
https://github.com/bitwalker/libcluster/blob/main/lib/strategy/kubernetes_dns.ex
you are suggestion that i need to tweak the get_nodes
method here:
libcluster/lib/strategy/kubernetes_dns.ex
Line 107 in 5240d23
to also additionally query for a specific version or at least only matching version numbers ?
from libcluster.
@amacciola you can't extract that information from DNS server, instead you should modify that function in lib/strategy/kubernetes.ex. K8s API returns a lot of information about the pod including labels that you need to use to store the version.
from libcluster.
@AndrewDryga i see. So its changing
libcluster/lib/strategy/kubernetes.ex
Lines 232 to 252 in 5240d23
so include additional params to only return info for certain version info
from libcluster.
@amacciola yes, you want to query for pods and return only the ones that match your current version
from libcluster.
@AndrewDryga i am working on testing this new strategy out now so thanks for the insight. But i just wanted to make sure i understood how some of the Libcluster combined with Horde registry code is working under the hood.
If we have 3 pods running for the same application. Each of these pods have lets say server_1
registered in the HordeRegistry.
- pod_1 with version_1
- pod_2 with version_1 -> running server_1
- pod_3 with version_1
If we then trigger an update for version_2
, which contains a new service that gets registered in the Horde Registry, server_2
. Lets say the update starts with pod_3
. When pod_3
comes online with the new version and finds pod_1
and pod_2
.
Does it just pick a process_id from one of the 3 pods to to try and start the new service on ? So you will have a 2 in 3 chance it tries to start the new service on a pod with version_1
and not version_2
. ???
from libcluster.
I'm not using Horde but the pods with version 1 would not see pods with version 2 in the Erlang cluster, so basically, for each of the islands (one per version), everything would behave like it's a cluster with the same codebase. If you have globally unique jobs it also means that you will have two of the workers started (one per island).
from libcluster.
For now i have just created a separate HordeRegistry for each Genserver we would want to be leveraging the Libcluster strategies. As long as we dont have too many its a minor annoyance to fix this issue
from libcluster.
Related Issues (20)
- crypto:block_encrypt/4 is removed in OTP 24 HOT 3
- Question: how to subscribe to events from the Kubernetes DNS strategy? HOT 1
- Gossip error with OTP-24 and libcluster 3.3.0 HOT 13
- Unable to get libcluster to connect over Kubernetes :pods :ip
- A proposal of enhancement to the epmd strategy HOT 5
- Nodes no longer connecting after upgrade to 3.3.0 HOT 2
- Spam of warn messages making logs hard to read HOT 5
- Tag for 3.3.1 on Github HOT 2
- Q: Connect a non release pod to a cluster of releases using Strategy.Kubernetes with mod IP and pod lookup
- Failed to connect using the Cluster.Strategy.Kubernetes strategy HOT 6
- Gossip strategy fails with Erlang 25.1 HOT 8
- Libcluster unable to connect when new deploy happens k8s HOT 2
- :erpc.multicast/4 not working with Cluster.Strategy.Gossip strategy HOT 1
- Default config for Gossip strategy fails in 3.3.2 HOT 4
- DNS Poll - max stable Cluster Size = max DNS Entry Response Count HOT 1
- Accept a list of node_basenames for the DNSPoll strategy HOT 1
- Kubernetes Strategy OTP 26 Incompatibility HOT 1
- Changelogs and Tags
- self signed certs fail in otp 26
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from libcluster.