Upgrade to Pro — share decks privately, control downloads, hide ads and more …



WORKSHOP: AKKA CLUSTER MANAGEMENT ON KUBERNETES at http://scalar-conf.com/ & https://scala.io/ 2018


Jeferson David Ossa

April 07, 2018


  1. Akka cluster management on Kubernetes “One Actor is no Actor

    - they come in systems” — Carl Hewitt
  2. About me Jeferson David Ossa @unyagami on twitter Developer at

  3. The aim of this workshop is to get familiar with

    Akka Management Service Discovery using Kubernetes API. We will create a stateful distributed service with persistent entities via sharding in persistence mode. A account's general balance which will receive credits and debits from potentially multiple simultaneous sources.
  4. The tools • Sbt ◦ https://www.scala-sbt.org/download.html • Docker ◦ https://docs.docker.com/install/

    • Minikube ◦ https://kubernetes.io/docs/tasks/tools/install-minikube/ • Cassandra ◦ http://cassandra.apache.org/download/
  5. The repo https://github.com/jedossa/akka-cluster-k8s.git minikube start --memory=4096 sbt groll initial

  6. The image eval $(minikube docker-env) sbt docker:publishLocal ./create

  7. None
  8. Akka Cluster • Node • Seed Node • Cluster •

    Leader • Gossip • Convergence • Failure Detector
  9. Membership Life Cycle

  10. Akka Management

  11. Bootstrap Process

  12. Service Discovery Akka Discovery provides a simple interface around various

    ways of locating services, such as DNS. Kubernetes API • Find pods labeled with the name of the Akka Management port
  13. Cluster Sharding How to distribute entities across the entire cluster

    with location transparency. Send messages without requiring the sender to know the location of the destination actor. Send messages to ShardRegion Actor, wich knows how to route it. How does it work ? sbt: groll next, docker:publishLocal ./delete, ./create
  14. Akka Persistence Enables stateful actors to persist their internal state

    so that it can be recovered when an actor is started, restarted after a JVM crash or by a supervisor, or migrated in a cluster. Only changes to an actor’s internal state are persisted but never its current state directly (except for optional snapshots) sbt: groll next, docker:publishLocal ./delete, ./create
  15. References • https://developer.lightbend.com/docs/akka-management/current/akka-manag ement.html • https://doc.akka.io/docs/akka/2.5/cluster-usage.html • https://doc.akka.io/docs/akka/2.5/cluster-sharding.html • https://doc.akka.io/docs/akka/2.5/persistence.html

    • https://github.com/akka/akka-management/tree/master/bootstrap-demo/kuber netes-api