13 Clustering, part 2

 

This chapter covers

  • Bootstrapping a cluster in Kubernetes
  • Using Split Brain Resolver to automate shutting down nodes
  • Creating a singleton actor

In chapter 8, you learned how to create a cluster with seed nodes defined in the configuration. These are fixed IPs. Creating a cluster this way is practical, but it isn’t a setup you’ll use to go into production. This chapter starts with the same idea of fixed IPs to local deployment but uses the Akka Cluster Bootstrap module. You learn how to use this module to create an Akka cluster in Kubernetes using the Kubernetes API.

NOTE

The source code for this example is available at www.manning .com/books/akka-in-action-second-edition or https://github.com/franciscolopezsancho/akka-topics/tree/main/chapter13a. You can find the contents of any snippet or listing in the .scala file with the same name as the class, object, or trait.

13.1 Akka Cluster Bootstrap

To create a cluster with Akka Cluster Bootstrap, you need the following dependencies:

val AkkaVersion = "2.6.20"
val AkkaManagementVersion = "1.1.4"

libraryDependencies ++= Seq(
 "com.lightbend.akka.management" %% "akka-management-cluster-bootstrap" % 
[CA]AkkaManagementVersion,
 "com.typesafe.akka" %% "akka-discovery" % AkkaVersion
)

13.1.1 Clustering in local

13.1.2 Cluster in action

13.2 Clustering with the Kubernetes API

13.2.1 Creating the Docker image

13.2.2 Kubernetes deployment

13.2.3 Optional: Setting Java options

13.2.4 Kubernetes role and role binding

13.2.5 Service account

13.3 Split Brain Resolver

13.3.1 An unreachable problem