mik284
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
Trending in Questions
I’m working on a project that simulates the bumbl example in the programming phoenix book. It acts almost like an email client. We have a...
New
Hello,
I know there is an approach for handling lists that allows for optimized traversal, but I can’t recall the specific method (somet...
New
I’m seeing that a list inside a Kino.DataTable will be interpreted as a charlist, even if the Kino.configure() is set to charlists: :as_l...
New
Documentation
While reading the Scoped Routes section, I noticed that the documentation currently refers to a problem without explainin...
New
So my question is quite simple and i have found no conclusive answer on forum, google or AI.
Should we use :erlang.float for Integer to ...
New
Hi, I’ve just set up an application with ash_authentication. There is only magic link strategy for now, so there is no confirmation add o...
New
If a change or preparation module uses Ash.Changeset.get_argument/2 or Ash.Query.get_argument/2 (or any of the other get_argument functio...
New
Other Trending Topics
I am happy to introduce the very α version of the new programming language compiled to BEAM.
Welcome Cure.
It has literally three kille...
New
Hi there! We created Gust: A task orchestrator inspired by Airflow.
For those who have never heard about Aiflow, it’s a Python-based wor...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
With AI doing more of the implementation work, I’ve been wondering how much coding I should deliberately keep doing myself.
My main conc...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixirconf-us
- #ai
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #hex
- #security
- #metaprogramming











Showing Posts 1 to 8- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
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
Considered using this strategy ?!
krasenyp
Small correction. There’s no fault tolerance with one or two instances. Always go with three or larger odd number.
rhcarvalho
Context matters here. Maybe you’re thinking about distributed consensus?
Schultzer
Also, systemd provides must of the functionality that K8 would do without the complexity. So even if your application crash it will get restarted.
manhvu
K8s create pod with dynamic hostname & IP is hard for Elixir cluster.
Our way, maps hostname to role (or Id) and store it on every nodes. Any node in cluster can search other nodes by role/id for calling rpc. In this way, we can scale out for our service (has same role for multi nodes, select one from that for doing task).
Ex: :“pod1@dns”, :“pod2@dns” have role :web and :“pod3@dns” has role :data.
I think other way is use prefix for hostname of pod and select of of that by check prefix (ex: :“web.pod1@dns”, :“web.pod2@dns”, :“data.pod@dns”,…) by convert Elixir node name to string.
I solved this issue for my MVP by write new small lib for mapping role to node name. I shared on my blog.
Hope you can get some idea for your case.
Updated: Add more details
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
:globalregistered, 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