Improve SBR’s decision process

Deploying on Kubernetes opens the door to use Kubernetes-provided mechanisms for decision-making. The Akka Split-Brain Resolver new tab can use a Lease new tab backed by Kubernetes to control which side of a cluster may remain up during a split-brain scenario.

This How-To guide assumes you are developing an application based on Akka Cluster and already enabled and configured Akka Cluster’s Split-Brain Resolver.

Add the Kubernetes Lease dependency

First make sure your application includes the SBR and the Kubernetes Lease dependencies on the build:

"" %% "akka-lease-kubernetes" % AkkaManagementVersion

Setup your Kubernetes Cluster and AkkaMicroservice

When installing the Akka Operator on your Kubernetes cluster using the Helm chart you will also install the Akka Kubernetes Lease CRD.

Once the CRD is installed, you can configure your Akka Microservice to back the SBR implementation with a Kubernetes Lease enabling it on the AkkaMicroservice CR:

kind: AkkaMicroservice
  name: shopping-cart-service
  image: <image>
    useKubernetesLease: true (1)
1 When using a kubernetes lease as a backend for the Split-Brain Resolver, the operator will name the lease <>-akka-sbr. In the example above, the lease will be named shopping-cart-service-akka-sbr.