Giter Site home page Giter Site logo

demo-mesh-arena's Introduction

demo-mesh-arena

Slides

This demo was presented at DevopsDday in the Velodrome, Marseilles' famous stadium. Here are the slides, in French. Or in English.

Pre-requisite

  • Kubernetes or OpenShift cluster running (ex: minikube 0.27+ / minishift)
  • Istio 1.0+ with Kiali installed, for instance download a release (Ex: 1.0.5) then:
tar -zxvf istio-1.0.5-linux.tar.gz
cd istio-1.0.5/
helm template install/kubernetes/helm/istio --name istio --namespace istio-system --set kiali.enabled=true --set tracing.enabled=true > $HOME/istio.yaml
kubectl apply -f install/kubernetes/helm/istio/templates/crds.yaml
kubectl create namespace istio-system
kubectl apply -f $HOME/istio.yaml
export PATH=$PATH:`pwd`/bin
  • Clone this repo locally, cd to it.
git clone [email protected]:jotak/demo-mesh-arena.git
cd demo-mesh-arena

As a general note for this demo, some docker images will have to be downloaded while we're deploying the stuff. First time you run the demo, we don't expect things to come up immediately. You can run at anytime:

kubectl get pods
# or (for istio/kiali):
kubectl get pods -n istio-system

to see when deployed pods are ready.

Note, for OpenShift users, you may have to grant extended permissions:

oc adm policy add-scc-to-user privileged -z default

Open Kiali

For simplicity we'll use kube's port-forward. If you wish to share access to Kiali from other hosts, you would have to setup an ingress or an OpenShift route instead.

Note, for some reason, I found port-forward not reliable when applied quickly after setting up the service. Maybe wait up to ~one minute before running the command.

In a new terminal:

kubectl port-forward svc/kiali 20001:20001 -n istio-system

Open http://localhost:20001 in a browser.

Open Jaeger

Tracing data generated from microservices and Istio can be viewed in Jaeger by port-forwarding jaeger-query service.

kubectl port-forward svc/jaeger-query 16686:16686 -n istio-system

AI service generates trace named new_game for each game. This way we are able to trace player's movement on the stadium. The other interesting trace is from ui service called on-start it captures all initialization steps performed at the beginning of the game.

Deploy micro-service UI

kubectl apply -f <(istioctl kube-inject -f ./services/ui/Deployment.yml)
kubectl create -f ./services/ui/Service.yml
kubectl apply -f mesh-arena-gateway.yaml 

Open in browser

(Wait a little bit because port-forward?)

kubectl port-forward svc/istio-ingressgateway 8080:80 -n istio-system

Open http://localhost:8080 in a browser.

Deploy stadium & ball

kubectl apply -f <(istioctl kube-inject -f ./services/stadium/Deployment-Smaller.yml)
kubectl create -f ./services/stadium/Service.yml
kubectl apply -f <(istioctl kube-inject -f ./services/ball/Deployment.yml)
kubectl create -f ./services/ball/Service.yml

Deploy 2x2 players

kubectl apply -f <(istioctl kube-inject -f ./services/ai/Deployment-2-locals.yml)
kubectl create -f ./services/ai/Service-locals.yml
kubectl apply -f <(istioctl kube-inject -f ./services/ai/Deployment-2-visitors.yml)
kubectl create -f ./services/ai/Service-visitors.yml

Second ball

kubectl apply -f <(istioctl kube-inject -f ./services/ball/Deployment-v2.yml)

Apply weight on balls

istioctl create -f ./services/ball/destrule.yml
istioctl create -f ./services/ball/virtualservice-75-25.yml

Messi / Mbappé

kubectl apply -f <(istioctl kube-inject -f ./services/ai/Deployment-Messi.yml)
kubectl apply -f <(istioctl kube-inject -f ./services/ai/Deployment-Mbappe.yml)

Each his ball

istioctl replace -f ./services/ball/virtualservice-by-label.yml

Reset

kubectl delete -f ./services/ai/Deployment-Messi.yml
kubectl delete -f ./services/ai/Deployment-Mbappe.yml
istioctl delete -f ./services/ball/virtualservice-by-label.yml

Deploying burst ball (500 errors) unused

istioctl create -f ./services/ball/virtualservice-all-to-v1.yml
kubectl apply -f <(istioctl kube-inject -f ./services/ball/Deployment-burst.yml)

Burst ball with shadowing

istioctl replace -f ./services/ball/virtualservice-mirrored.yml

Remove shadowing, put circuit breaking

istioctl delete -f ./services/ball/virtualservice-mirrored.yml
istioctl replace -f ./services/ball/destrule-outlier.yml

El Clasico, Caramba!

D-I-S-C-L-A-I-M-E-R This is going to deploy 20 players on the field, it's quite CPU intensive, it is NOT recommended to run on a PC / single-node cluster, or your cluster may suffer.

kubectl delete -f ./services/ball/Deployment-v2.yml
kubectl delete -f ./services/ai/Deployment-2-locals.yml
kubectl delete -f ./services/ai/Deployment-2-visitors.yml
kubectl apply -f <(istioctl kube-inject -f ./services/ai/Deployment-OM.yml)
kubectl apply -f <(istioctl kube-inject -f ./services/ai/Deployment-PSG.yml)

To clean up everything at any time (but Istio/Kiali)

kubectl delete deployments ai-locals-om
kubectl delete deployments ai-visitors-psg
kubectl delete deployments ai-locals-basic
kubectl delete deployments ai-visitors-basic
kubectl delete deployments ai-visitors-messi
kubectl delete deployments ai-locals-mbappe
kubectl delete deployments ball
kubectl delete deployments ball-v2
kubectl delete deployments stadium-small
kubectl delete deployments ui
kubectl delete svc ai-locals
kubectl delete svc ai-visitors
kubectl delete svc ball
kubectl delete svc stadium
kubectl delete svc ui
kubectl delete virtualservices mesh-arena
kubectl delete destinationrules ball-dr

PS: I'm sure there's a better command with labels :)

To build the demo

For the first build, it is necessary to get the JS dependencies on your filesystem:

cd services/ui/src/main/resources/webroot/
npm install
# back to project root
cd -

Then build everything:

# Trigger maven build + docker builds
# Ex: for docker namespace "myname" and tag "dev"
./buildall.sh myname dev

Then update all the deployment YAML to have the correct docker tag on images

To run the microservices only from the IDE, without Kube / Istio / Kiali:

  • Run UI's main
  • Open browser to localhost:8080
  • Run Ball's main
  • Run Stadium's main
  • Start game: curl http://localhost:8082/start
  • Run Visitors and Locals AIs

demo-mesh-arena's People

Contributors

jotak avatar zepouet avatar pavolloffay avatar

Watchers

 avatar

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.