2021 Call for Code Awards: Live from New York, with SNL’s Colin Jost! Learn more

Deploy Akka Cluster on Kubernetes


Akka Cluster is a fault-tolerant peer-to-peer cluster membership service. Kubernetes provides mulitple features that are a great fit for running applications built with Akka Cluster. This code pattern shows you how to configure your Akka Cluster application to run on top of Kubernetes, taking advantage of its many standard features.


Akka is a toolkit for building distributed, message-driven applications for Java and Scala. Developers look to Akka to manage concurrency, elasticity, and resilience. They start with this actor-based system before adopting frameworks such as Play and Lagom.

Kubernetes automates deployment and management of containerized applications. Because an Akka Cluster manages applications but not containers, you’ll need to use container orchestration — and Kubernetes is a logical choice. However, due to different design perspectives, deploying Akka Clusters on Kubernetes is not completely straightforward. Akka Cluster is elastic and decentralized. A Kubernetes cluster is also elastic. So how do you seamlessly combine the two to get the benefits of each?

In this code pattern, we will walk through the steps to deploy Akka Cluster on Kubernetes. We’ll show you the challenges involved, and how to overcome them. You’ll complete deployment steps and discover how Kubernetes can seamlessly manage Akka Cluster scaling using built-in Akka functionality, and you’ll learn how to use StatefulSet to bridge the different node and pod requirements in Akka and Kubernetes, respectively.

If you’re a developer looking to tap into Akka’s libraries to design scalable, resilient systems and you want to take advantage of container orchestration to manage your services and workloads, this pattern is your starting point!



  1. Add tools to the the Docker base image.
  2. Use the sbt build tool to build the sample app in the Docker image.
  3. Push the Docker image to a Docker repository.
  4. Deploy Akka Cluster on Kubernetes with a StatefulSet.
  5. Try Akka Cluster scaling.


Find the detailed steps for this pattern in the README. The steps will show you how to:

  1. Clone the repo
  2. Prerequisites
  3. Build the Docker base image
  4. Build the sample app
  5. Deploy the cluster on Kubernetes
  6. Confirm the sample app is working