mik284
Running into challenges with nodes discovering each other and maintaining cluster stability using Libcluster on Kubernetes
Hi everyone,
Am trying to set up node clustering for my Elixir app using Libcluster on Kubernetes (hosted on DigitalOcean). I am running into some challenges with nodes discovering each other and maintaining cluster stability, I am also using Oban for background jobs.
Specifically, would love guidance or examples on:
-
Configuring Libcluster for K8s service discovery
-
Best practices for running Elixir nodes in pods
-
Handling dynamic scaling while keeping the cluster healthy
Any tips, example configs, or experiences you can share would be really appreciated!
Thanks in advance
Most Liked
rhcarvalho
I don’t know what your use cases are, but my advice would be to consider if you really need Kubernetes.
A single BEAM instance (or two, for fault tolerance) on DigitalOcean can serve a large number of concurrent users.
K8s adds a lot more concepts and moving parts to your deployment (I’m a former OpenShift dev), and while it does make sense in some cases, it is not always the best solution.
Are you using Phoenix? The official docs give you some guidance:
Schultzer
This is the right answer. And setting up K8 cluster for distributed Elixir becomes more complex without the benefits.
I would only use K8 if I had to manage a mixture of different stacks and wanted a standardize way.
acrolink
Last Post!
xpg
We are using BEAM clustering on Kubernetes both in production and also in several development and testing environments. We are using libcluster with Cluster.Strategy.Kubernetes.DNS — libcluster v3.5.0 . It works quite well.
My main issue with this setup (besides Kubernetes complexities) is the fact that all BEAM nodes will start quite a few BEAM processes that are :global registered, which will be shutdown as soon as the node joins the cluster.
We do have dynamic scaling using Karpenter, but are currently doing it by CPU load, which is not an ideal metric.
As other’s have also said, I would strongly consider if Kubernetes is needed, as it does complicate things. But I think it does work quite well together with the BEAM even though the BEAM can live without it ![]()
Popular in Questions
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #elixirconf-us
- #advent-of-code
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #hex









