# Akka-cluster-deploy-kubernetes **Repository Path**: mirrors_ibm/Akka-cluster-deploy-kubernetes ## Basic Information - **Project Name**: Akka-cluster-deploy-kubernetes - **Description**: Deploy an AKKA cluster to kubernetes - **Primary Language**: Unknown - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2020-11-23 - **Last Updated**: 2025-08-09 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README [![Build Status](https://travis-ci.org/IBM/watson-banking-chatbot.svg?branch=master)](https://travis-ci.org/IBM/watson-banking-chatbot) ![IBM Cloud Deployments](https://metrics-tracker.mybluemix.net/stats/527357940ca5e1027fbf945add3b15c4/badge.svg) # Deploy Akka Cluster on Kubernetes In this Code Pattern, we will deploy a simple Akka application on Kubernetes to demonstrate how you can build an inherently scalable, distributed solution. Akka is “a set of open-source libraries for designing scalable, resilient systems that span processor cores and networks”. Akka Cluster, in particular, enables the distribution of an application over a cluster, thereby lending elasticity to the application by automatically scaling out or in with the number of members in the cluster. Kubernetes is a container orchestration platform and has the ability to automatically scale the number of pods up or down in response to workload. Together, the two work in concert: your Akka cluster expands automatically as Kubernetes scales the number of pods running for a particular Kubernetes deployment. One key enabler of this elasticity is the ability for new nodes to join the Akka cluster automatically. Akka clusters are a peer-to-peer framework, however some nodes must be designated “seed” nodes when the cluster is initialized. These serve as an initial point of contact for new nodes. When new nodes are brought online, they can join the cluster automatically by first sending a message to all seed nodes in the cluster, followed by a “join” command to the seed node that responds first. Without seed nodes you would have to manually or programmatically add nodes to the cluster. This solution uses Docker to build a single container image. In Kubernetes, we use StatefulSet rather than Deployment to guarantee the orderly startup of seed nodes. ## Flow ![Architecture Diagram](https://media.github.ibm.com/user/1650/files/3ad7cfd0-161b-11e8-9f5e-3324668e4739) 1. Add tools to the the Docker base image 2. Use sbt to build the sample app into docker image 3. Push the docker image to a docker repository 4. Deploy the Akka cluster on Kubernetes with `statfulset` 5. Try out the scaling of Akka cluster ## Included components * [Akka](https://akka.io/): A free and open-source toolkit and runtime simplifying the construction of concurrent and distributed applications on the JVM. * [Kubernetes](https://kubernetes.io): An open-source system for automating deployment, scaling, and management of containers. * [Docker](https://www.docker.com): Container building,shipping and running platform * [sbt](http://www.scala-sbt.org/): The interactive build tool for Scala * [Scala](https://www.scala-lang.org/): A general-purpose programming language providing support for functional programming and a strong static type system. # Watch the Video # Steps 1. [Clone the repo](#1-clone-the-repo) 2. [Prerequisite](#2-prerequisite) 3. [Build the Docker base image](#3-build-the-docker-base-image) 4. [Build the sample app](#4-build-the-sample-app) 5. [Deploy the cluster on Kubernetes](#5-deploy-the-cluster-on-kubernetes) 6. [Confirm the sample app is working](#6-confirm-the-sample-app-is-working) ### 1. Clone the repo Clone the `Akka-cluster-deploy-kubernetes` locally. In a terminal, run: ``` git clone https://github.com/IBM/Akka-cluster-deploy-kubernetes cd Akka-cluster-deploy-kubernetes ``` ### 2. Prerequisite * Create a Kubernetes cluster with either [Minikube](https://kubernetes.io/docs/getting-started-guides/minikube) for local testing, or with [IBM Bluemix Container Service](https://github.com/IBM/container-journey-template) to deploy in cloud. The code here is regularly tested against [Kubernetes Cluster from Bluemix Container Service](https://console.ng.bluemix.net/docs/containers/cs_ov.html#cs_ov) using Travis. * Ensure the Docker environment variable is configured to point to the registry used by the Kubernetes cluster. * Have [sbt](https://www.scala-sbt.org/download.html) installed. ### 3. Build the Docker base image Build the local Docker base image required by the example app: ```bash cat < GET /members HTTP/1.1 > Host: myapp-0:9000 > User-Agent: curl/7.55.0 > Accept: */* > < HTTP/1.1 200 OK < Server: akka-http/10.0.10 < Date: Tue, 12 Dec 2017 04:06:32 GMT < Content-Type: application/json < Content-Length: 147 < { "members" : [ { "address" : "akka.tcp://myapp@myapp-0.myapp.default.svc.cluster.local:2551", "status" : "Up", "roles" : [ ] }, { "address" : "akka.tcp://myapp@myapp-1.myapp.default.svc.cluster.local:2551", "status" : "Up", "roles" : [ ] }, { "address" : "akka.tcp://myapp@myapp-2.myapp.default.svc.cluster.local:2551", "status" : "Up", "roles" : [ ] }, { "address" : "akka.tcp://myapp@myapp-3.myapp.default.svc.cluster.local:2551", "status" : "Up", "roles" : [ ] } ] * Connection #0 to host myapp-0 left intact ``` # Links # Learn more * **Kubernetes on IBM Cloud**: Deliver your apps with the combined the power of [Kubernetes and Docker on IBM Cloud](https://www.ibm.com/cloud-computing/bluemix/containers) # License This code pattern is licensed under the Apache Software License, Version 2. Separate third party code objects invoked within this code pattern are licensed by their respective providers pursuant to their own separate licenses. Contributions are subject to the [Developer Certificate of Origin, Version 1.1 (DCO)](https://developercertificate.org/) and the [Apache Software License, Version 2](http://www.apache.org/licenses/LICENSE-2.0.txt). [Apache Software License (ASL) FAQ](http://www.apache.org/foundation/license-faq.html#WhatDoesItMEAN)