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

akka-cluster-k8s

 akka-cluster-k8s

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

Jeferson David Ossa

April 07, 2018
Tweet

More Decks by Jeferson David Ossa

Other Decks in Technology

Transcript

  1. Akka cluster management
    on Kubernetes
    “One Actor is no Actor - they come in systems”
    — Carl Hewitt

    View Slide

  2. About me
    Jeferson David Ossa
    @unyagami on twitter
    Developer at s4n.co

    View Slide

  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.

    View Slide

  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/

    View Slide

  5. The repo
    https://github.com/jedossa/akka-cluster-k8s.git
    minikube start --memory=4096
    sbt groll initial

    View Slide

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

    View Slide

  7. View Slide

  8. Akka Cluster
    ● Node
    ● Seed Node
    ● Cluster
    ● Leader
    ● Gossip
    ● Convergence
    ● Failure Detector

    View Slide

  9. Membership Life Cycle

    View Slide

  10. Akka Management

    View Slide

  11. Bootstrap Process

    View Slide

  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

    View Slide

  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

    View Slide

  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

    View Slide

  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

    View Slide