Both the simulator and visualizer projects share the same Kubernetes cluster so the following step is done once for both projects.
Go to Getting started with eksctl for directions on setting up EKS and Kubernetes CLI tools.
Recommend that you create an EKS cluster with two or more Kubernetes nodes.
Once the Kubernetes cluster has been created you can use the following command to add it to your local Kubernetes configuration settings.
aws eks update-kubeconfig --name <your-cluster-name> --region <your-aws-region>
The kubectl
CLI provides a nice Kubectl Autocomplete feature for bash
and zsh
.
See the kubectl Cheat Sheet for instructions.
Also, consider installing kubectx
, which also includes kubens
.
Mac:
brew install kubectx
Arch Linux:
yay kubectx
You may also want to create an alias for the kubectl
command, such as kc
.
alias kc=kubectl
You may want to deploy the Kubernetes dashboard. This is an optional step. To deploy the dashboard follow the Tutorial: Deploy the Kubernetes Dashboard (web UI).
Git clone the project repoisitory.
git clone https://github.com/mckeeh3/akka-cluster-kubernetes-visualizer.git
After cloning the project, cd
into the project directory then build the Docker image.
From the akka-cluster-kubernetes-visualizer
project directory.
mvn clean package
Next, tag and push the image to the public Docker repo. This requires that you have a Docker account.
$ docker tag akka-k8-visualizer <your-docker-username>/akka-k8-visualizer:latest
...
$ docker push <your-docker-username>/akka-k8-visualizer
Create the Kubernetes namespace. The namespace only needs to be created once.
kubectl create namespace visualizer
Set this namespace as the default for subsequent kubectl
commands.
kubectl config set-context --current --namespace=visualizer
First, edit the kubernetes/akka-cluster-amazon-eks.yml
file changing the Docker username.
image: <your-docker-username>/akka-k8-visualizer:latest
Then deploy the microservice.
kubectl apply -f kubernetes/akka-cluster-amazon-eks.yml
namespace/visualizer created
deployment.apps/visualizer created
role.rbac.authorization.k8s.io/pod-reader created
rolebinding.rbac.authorization.k8s.io/read-pods created
Check if the pods are running. This may take a few moments.
$ kubectl get pods -n visualizer
NAME READY STATUS RESTARTS AGE
visualizer-5b4cf87d4d-5b7w6 1/1 Running 0 3m31s
visualizer-5b4cf87d4d-hzp7n 1/1 Running 0 3m31s
visualizer-5b4cf87d4d-pbst2 1/1 Running 0 3m31s
Use the following commands to scale the Akka cluster nodes by adjusting the number of Kubernetes pods.
kubectl scale --replicas 5 deployment/visualizer -n visualizer
Create a load balancer to enable access to the visualizer microservice HTTP endpoint.
$ kubectl expose deployment visualizer --type=LoadBalancer --name=visualizer-service -n visualizer
service/visualizer-service exposed
$ kubectl get services visualizer-service -n visualizer
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
visualizer-service LoadBalancer 10.100.91.15 ad110f7c353d94e9c8642b36206a74a8-1760520412.us-east-1.elb.amazonaws.com 8080:31961/TCP,8558:32054/TCP,2552:31715/TCP 62s
Use the hostname provided EXTERNAL-IP column in the above command. In this example, the host name is
ad110f7c353d94e9c8642b36206a74a8-1760520412.us-east-1.elb.amazonaws.com.
The URL to the visualizer as follows:
http://<EXTERNAL-IP>:8080
e.g.
http://ad110f7c353d94e9c8642b36206a74a8-1760520412.us-east-1.elb.amazonaws.com:8080