roitraining / whack_a_pod

A demo application that turns a Kubernetes cluster into a Whack a Mole game, where the moles are pods.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Whack-a-pod

This is a demo that can be used to show how resilient services running on Kubernetes can be.

Use either the version available at /next.html, or the more advanced version at /advanced.html.

Getting Started

  1. Create Project in Cloud Console

  2. Open Cloud Shell

  3. Clone this repo

    git clone https://github.com/roitraining/whack_a_pod
  4. Run the following commands to set up the demo cluster/app:

    cd whack_a_pod
    
    . ./setup.sh

It will take about 7 minutes for script to finished, and you will need to wait a good 5-7 minutes after the script is done for the Ingress to be functional.

Run demo - advanced skin

  1. Find the pod external ip with
    kubectl get ingress wap-ingress
  2. Visit <ingress-ip>/advanced.html
  3. Click to deploy
  4. Show nodes and pods in GUI
  5. Show pod info in log pane on right side
  6. Kill one pod, show it terminating and then respawning in log pane
  7. Kill multiple pods and show them being replaced
  8. Kill one node and show all pods on another node
  9. Reinstate node and kill some nodes to show respawning on new node
  10. Show yaml files, etc.

Clean Up

  1. In Cloud Shell, run
    . ./cleanup.sh

Architecture

There are three Kubernetes services that make up the whole application:

  1. Game Game contains all of the front end clients for the game, both the carnival version and the Google Cloud Next version.
  2. Admin Admin contains all of the logic for managing the whole application. This is the application the front end calls to get a list of the pods running the color api, it also has calls to create and delete deployments, delete pods, and drain and uncordon nodes.
  3. Api Api contains two service calls: color and color-complete. Color is a random hexidecimal RGB color value. Color-complete is the same as color, but also sends the pod name of the pod that answered the service call.

About

A demo application that turns a Kubernetes cluster into a Whack a Mole game, where the moles are pods.

License:Apache License 2.0


Languages

Language:JavaScript 37.2%Language:Go 30.9%Language:CSS 14.0%Language:HTML 12.9%Language:Shell 3.2%Language:Dockerfile 1.8%