Giter VIP home page Giter VIP logo

akka-cluster-orchestration-example's Introduction

Akka Cluster Orchestration Example

Project Status

Lightbend Orchestration is no longer actively developed and will reach its End of Life on April 15, 2020.

We recommend Migrating to the Improved Kubernetes Deployment Experience.

Summary

This is a very simple Akka Cluster and Akka HTTP application. Its main purpose is to show how you can build a similar application and take advantage of the Lightbend Orchestration for Kubernetes to easily and safely deploy to Kubernetes with minimal configuration required.

Deployment

Prerequisites:

You'll need version 0.9.0 (or later) of the CLI.

If you already have a Minikube and wish to start fresh, run minikube delete to remove your existing Minikube.

  1. Start minikube
minikube start

eval $(minikube docker-env)

minikube addons enable ingress
  1. Build and Deploy project

There's two ways to deploy this project. You can do it from within SBT or from the command line.

SBT

This is the developer friendly method of running the project. Simply invoke the deploy minikube task.

sbt 'deploy minikube'

Command Line

This matches more closely what you'd do in a production environment. You'll build the project. Then, you'll use rp to generate resources for it and pipe those to kubectl.

Build project

sbt docker:publishLocal

Inspect images

docker images

Deploy project

rp generate-kubernetes-resources akka-cluster-orchestration-example:0.1.0 \
  --generate-all \
  --ingress-annotation ingress.kubernetes.io/rewrite-target=/ \
  --ingress-annotation nginx.ingress.kubernetes.io/rewrite-target=/ \
  --pod-controller-replicas 3 | kubectl apply -f -
  1. View Results (Note: -k is needed because the certificate is self-signed)

This may take 30 seconds or so until all pods have been started and the cluster has formed. You should see a member listing.

kubectl get all
NAME                                               DESIRED   CURRENT   UP-TO-DATE   AVAILABLE   AGE
deploy/akka-cluster-orchestration-example-v0-1-0   3         3         3            3           1m

NAME                                                      DESIRED   CURRENT   READY     AGE
rs/akka-cluster-orchestration-example-v0-1-0-6d8b954c45   3         3         3         1m

NAME                                               DESIRED   CURRENT   UP-TO-DATE   AVAILABLE   AGE
deploy/akka-cluster-orchestration-example-v0-1-0   3         3         3            3           1m

NAME                                                      DESIRED   CURRENT   READY     AGE
rs/akka-cluster-orchestration-example-v0-1-0-6d8b954c45   3         3         3         1m

NAME                                                      READY     STATUS    RESTARTS   AGE
po/akka-cluster-orchestration-example-v0-1-0-6d8b954c45-2jzbb   1/1       Running   0          1m
po/akka-cluster-orchestration-example-v0-1-0-6d8b954c45-vfkg6   1/1       Running   0          1m
po/akka-cluster-orchestration-example-v0-1-0-6d8b954c45-zq8wj   1/1       Running   0          1m

NAME                                     TYPE        CLUSTER-IP   EXTERNAL-IP   PORT(S)                         AGE
svc/akka-cluster-orchestration-example   ClusterIP   None         <none>        10000/TCP,10001/TCP,10002/TCP   1m
svc/kubernetes                           ClusterIP   10.96.0.1    <none>        443/TCP                         3m
curl -k "https://$(minikube ip)/cluster-example"
Akka Cluster Members
====================

akka.tcp://[email protected]:10000
akka.tcp://[email protected]:10000
akka.tcp://[email protected]:10000
  1. Run the job (Optional)

This application has a job in it that joins the existing cluster, prints a message, and then exits.

rp generate-kubernetes-resources akka-cluster-orchestration-example:0.1.0 \
  --application my-job \
  --akka-cluster-join-existing \
  --generate-pod-controllers \
  --pod-controller-type job | kubectl apply -f -

You can then inspect the jobs output using:

kubectl logs jobs/akka-cluster-orchestration-example-v0-1-0

And lastly, remove the job, thus deleting logs:

kubectl delete jobs/akka-cluster-orchestration-example-v0-1-0
  1. Remove project (Optional)

If you wish to remove the resources, you can use kubectl delete as follows:

rp generate-kubernetes-resources akka-cluster-orchestration-example:0.1.0 \
  --generate-all --pod-controller-replicas 3 | kubectl delete -f -

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.