This repository contains a demo we did to showcase continuous development on Kubernetes with Skaffold and Jib. We gave the demo during the Skaffold for Java talk at Oracle Code One 2018.
-
Set up a Kubernetes cluster.
-
Allocate a static external IP to use.
-
(Recommended) Register a domain name. (We used
skaffold-code.one
.)- Add an A record to point to the allocated external IP.
-
Clone the repository:
$ git clone https://github.com/coollog/kubernetes-survey-app-demo
-
Make sure
kubectl
is configured correctly. -
Set the
EXTERNAL_IP
environment variable to the allocated external IP:export EXTERNAL_IP=???
-
Set up Ambassador for ingress:
$ kubectl create clusterrolebinding my-cluster-admin-binding --clusterrole=cluster-admin --user=$(gcloud info --format="value(config.account)") $ ./apply_ambassador.sh
-
Make sure
kubectl
is configured correctly. -
Start Skaffold:
$ skaffold dev
-
Once everything is up and running, visit your app at its domain name (or external IP).
-
Results are viewable at
/results
.
The survey prompt and options can be changed by editing the HTML files:
frontend-service/src/main/resources/public/index.html
- Only need to touch the
#options
div
.
frontend-service/src/main/resources/public/results.html
- Only need to touch the
Votes
constructor
, and change whatthis._votes
is set to. - Change the domain name in the
#banner
div
.
The following is a script for the demo:
-
State that we have a cluster set up on GKE already, and that it's simple to do so if you don't. All you would need to run is
gcloud container clusters create
. -
Give a brief overview of the app. Can show a diagram like:
-
Start Skaffold.
$ skaffold dev
-
Watch as Skaffold containerizes the 3 microservices and deploys them to the Kubernetes cluster without any extra effort. The app is now live.
-
Navigate to your app's domain to show the audience what they should expect to see. Something like:
-
Navigate to the
/results
page to display the results as they come in. The page will animate in realtime as people cast votes: -
Ask the audience to please take out their phones/laptops and navigate to the domain to cast their votes. Watch as the results roll in.
-
Make some comedic remark about the results coming in.
-
Now, it's time to show how easy it is to make a change to the app and have it updated live on the Kubernetes cluster.
-
Ask the audience to shout out a new option they would like to add to the survey. Pick one and add that to the survey in some code editor (
frontend-service
HTML files). Save the edits and watch as Skaffold automatically picks that up and re-containerizes/re-deploys the app, even quicker this time. Refresh the results page to see the new option show up. -
Have the audience cast votes with that option available as well and watch as results roll in.
-
(Optional) Shut down Skaffold and show that Skaffold cleans up the services from the cluster.
frontend-service
- Micronaut/Groovy
/
- take the survey/results
- survey results page
vote-service
- Spring/Java
/
- send vote data to this, publishes to notification-service
notification-service
- NodeJS
- Subscribes to vote notifications.