Skip to main content

Build Ultra-Scalable Backends with Pekko and Kubernetes

Struggling with delivery, architecture alignment, or platform stability?

I help teams fix systemic engineering issues: processes, architecture, and clarity.
→ See how I work with teams.


This article revisits why Akka became a popular choice for high-performance, message-driven backends—and why its 2024 license change pushed many teams toward open alternatives like Apache Pekko or Rust-based Ractor. It explains how the actor model’s concurrency, fault isolation and distributed design pair naturally with Kubernetes, whose autoscaling, self-healing and container orchestration provide the operational backbone for resilient microservice systems. Running actors as lightweight, horizontally scalable units inside k8s lets teams absorb traffic spikes, recover from failure automatically and deploy across regions or hybrid setups with ease. With a simple deployment YAML, Kubernetes manages replicas, load balancing and availability while the actor system handles concurrency and state isolation. The takeaway: for teams building elastic, robust backends—whether with Pekko, Ractor or legacy Akka—combining actor-based runtimes with Kubernetes creates an architecture that gracefully handles scale, failures and real-world complexity.

Update May 21, 2024: 

Lightbend, the company behind Akka, changed the license from Apache 2.0 to BSL, which makes Akka not really attractive anymore. The new license is in place from Akka 2.7 onwards. 

Pekko is a 2.6x fork of Akka, with the same functionalities,  maintained and further developed by the Apache Software Foundation, and is under Apache Software Licence 2 available.

Ractor is written in Rust, has network communication, single messaging, named actors and a cluster mode, and is under MIT license available.

------------------------------

Building a backend that can handle massive traffic and keep your users happy is tough. We're not talking about a simple website with a few hundred visitors a day. We're talking about high-performance systems that can handle spikes in traffic, process huge amounts of data, and keep chugging along even when things go wrong. I have made some great experiences with Akka as micro service in kubernetes, we use k8s to scale our IoT platform across different regions and hybrid setups. 

Running Akka in k8s is a great match from my point of view, they complement each other perfectly, allowing you to build backend systems that are not only scalable and resilient but also incredibly efficient and easy to manage.

Why Akka?

If you're not familiar with Akka, it's a toolkit and runtime for building highly concurrent, distributed, and resilient message-driven applications on the JVM. In plain English, this means it's a framework that helps you build apps that can handle a ton of stuff happening at once, spread the load across multiple machines, and keep running even when things go wrong.

The secret to Akka's power is the Actor Model. Actors are like little independent workers that can communicate with each other by sending messages. This makes it super easy to build complex systems that can scale up or down as needed.

Think of it like this: instead of having one overworked employee trying to juggle a thousand tasks, you have a team of specialists, each handling their own piece of the puzzle. This not only makes things more efficient, but it also makes it easier to recover from failures. If one actor crashes, the rest of the system can keep on running.

Why Kubernetes?

Now, let's talk about Kubernetes, or short k8s. Kubernetes is an open-source system for automating the deployment, scaling, and management of containerized applications, initially developed by Google to handle the infrastructure and applications for GCP.

What are containers? In a nutshell, containers are a way to package up an application and all its dependencies so that it can run reliably across different computing environments. There are multiple container management platforms out there, like Docker Swarm, Openshift, or Kubernetes. I personally like k8s, since it's easier to scale and distribute, plus you can better manage multiple installations in deployment sets, using Namespaces to distinguish between applications, etc etc. Kubernetes handles everything from scheduling containers on different machines to load balancing traffic to ensuring that your applications are always available.

Run Akka with k8s

There are multiple pros running Akka in k8s, first Akka actors are naturally suited to a microservices architecture. Each actor can be thought of as an independent service, handling specific tasks and communicating with other actors through messages. Kubernetes provides the perfect platform for deploying and managing these microservices.

2nd, Kubernetes excels at scaling applications up or down based on demand. With Akka actors running as microservices, you can easily add or remove actor instances to meet changing workloads. This ensures your backend can handle traffic spikes without breaking (given the cluster is set to autoscale). Adding a loadbalancer and scale out to the actors, k8s takes care to start new pods at a given load (scale-out), and also kills pods when the load goes back (scale-down). 

3rd, with Akka's built-in fault-tolerance mechanisms, combined with Kubernetes' self-healing capabilities, I create a backend that can withstand failures. If an actor crashes, Kubernetes can automatically restart it on a different node, ensuring uninterrupted operation. 

Here's a simplified ASCII diagram to illustrate the concept:

Akka with k8s simple architecture diagram


A yaml file for a simple setup looks like this one:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: my-akka-actor
spec:
  replicas: 3 
  selector:
    matchLabels:
      app: my-akka-actor
  template:
    metadata:
      labels:
        app: my-akka-actor
    spec:
      containers:
      - name: my-akka-actor
        image: my-akka-actor-image:latest
        ports:
        - containerPort: 8080 

---
apiVersion: v1
kind: Service
metadata:
  name: my-akka-actor-service
spec:
  selector:
    app: my-akka-actor
  ports:
    - protocol: TCP
      port: 80  # External port (can be different from containerPort)
      targetPort: 8080 
  type: LoadBalancer

This yaml tells Kubernetes to create three instances of your Akka actor, each running in its own container. Kubernetes will automatically manage these instances, ensuring they are spread across different nodes for high availability. The loadbalancer distributes the load, to have persistent session add a sticky mechanism, ideally with a session token.

If you want to build a backend that can handle anything you throw at it, Akka and Kubernetes can be your new best friends. They offer a scalable, resilient, and efficient solution that can help you deliver amazing user experiences.


If you need help with distributed systems, backend engineering, or data platforms, check my Services.

Most read articles

Building a Model-Agnostic Multi-Agent System with OpenClaw

Over one week we rebuilt our AI stack around OpenClaw’s multi-agent architecture to avoid provider lock-in and stop wasting premium tokens. By aligning models to tasks, diversifying fallbacks across providers, enforcing minimal tool access, and switching to memory-first workflows with ephemeral sessions, we reduced token usage per task by about 70% and cut our monthly bill by 77% while improving operational resilience. How We Achieved 77% Cost Reduction and Provider Independence Over the past week, we rebuilt our AI infrastructure around OpenClaw’s multi-agent architecture. The result was a 77% cost reduction , provider independence , and a delegation system that routes work to the most cost-effective model for each job. Below is the technical journey of optimizing a 7-agent squad with OpenClaw. The Challenge: Model Provider Lock-In We started with a simple problem: our entire squad defaulted to a single model provider. This created three issues: Cost inefficiency beca...

BacNet => MQTT in Production: The Real Cost of Bridging BACnet to MQTT at Scale

bacnet2mqtt looks simple in a README and expensive in production. Once BACnet polling, reconnection behavior, stale state, and MQTT publishing collide, teams discover they are not deploying a lightweight adapter but operating infrastructure. This article breaks down where bacnet2mqtt works, where it becomes a bottleneck, and which production patterns reduce the operational damage before incidents, backlogs, and silent data loss turn a building integration into a long-running engineering problem. I inherited a building controls integration problem 18 months ago. Three office floors. 217 BACnet sensors covering temperature, occupancy, and HVAC actuators. The data was trapped inside the building automation network while the business wanted analytics, reporting, and compliance visibility in the data platform. The obvious answer looked easy enough: deploy bacnet2mqtt, bridge BACnet into MQTT, and push the stream into the lakehouse stack. The repository made it sound like a w...

Get Apache Flume 1.3.x running on Windows

Since we found an increasing interest in the flume community to get Apache Flume running on Windows systems again, I spent some time to figure out how we can reach that. Finally, the good news - Apache Flume runs on Windows. You need some tweaks to get them running. Prerequisites Build system: maven 3x, git, jdk1.6.x, WinRAR (or similar program) Apache Flume agent: jdk1.6.x, WinRAR (or similar program), Ultraedit++ or similar texteditor Tweak the Windows build box 1. Download and install JDK 1.6x from Oracle 2. Set the environment variables    => Start - type " env " into the search box, select " E dit system environment variables ", click Environment Variables, Select " New " from the " Systems variables " box, type " JAVA_HOME " into " variable name " and the path to your JDK installation into "Variable value" (Example:  C:\Program Files (x86)\Java\jdk1.6.0_33 ) 3. Download maven from Apache 4. Set...