Thursday, September 06, 2018

[Conference - CodeEurope.pl] Developing Micro-services on Kubernetes

In April I had the chance to present at CodeEurope.pl, first in Warsaw on Apr 24th, and then in Wroclaw ("wroslof" was my best attempt at pronouncing Wroclaw) on Apr 26th.

It was a fun event, very well organized by Tomasz Kreczmar who headed up the team at Absolvent.pl, and it was a great experience to exchange with the other speakers on similar career tracks to myself.

So, why am I writing about this now?
Well, I'm preparing for some talks at Pyconfr, in Lille in October and needed to finally clean up the demo I'd prepared for CodeEurope.pl.  Although the slides were ready at the time I spent an intense but creative afternoon in a hotel  preparing my demo.

Recently it took me a while to figure out how I'd run the demo -  between jobs in April I'd created the demo on a borrowed MacBook.

So I wanted to take the time to properly document the setting up and running of the demo as I was pretty please with the result.

I've done that now, and that version is available at https://github.com/mjbright/ConferenceDemo.2018-04_codeeurope-microservices.

Slides from the presentation are available at https://mjbright.github.io/Talks/index.html#201804_codeeu.

I will be improving this demo and will post the new code and slides when that's done.  I intend to improve the visualization in particular with a clean slate implementation.

I'll also post a video of the demo, but right now I have to prepare my 3 Pyconfr [English version] sessions ... hope to see you in Lille!


Kubernetes Micro-service Demo with Visualization
The demo was showing some typical operations you would perform when deploying an application to Kubernetes.  In this case the application was a very simple Flask application communicating with a Redis backend acting as a counter.

Whilst that's not rocket science it allowed to show
- Deployment of the application components
- Exposing the components as services
- Using Nginx as an Ingress Controller
- Scaling of the Flask pods
- Rolling upgrade of the Flask pods
- ... and *piece de maitre* a cobbled together demo dashboard

Demo dashboard
I decided to create a "demo dashboard" where I could run commands, invoke the service and visualize the results all in the same browser window.

To be honest I don't want to reinvent the wheel, and I'd much rather use something like JupyterLab - I will certainly try that in the future - but I needed a quick and dirty solution.  I'm quite pleased with what I cobbled together in a (long) afternoon and I will continue to develop that before Pyconfr next month.

The demo dashboard, see below, integrates:
- In the top line a button to invoke my Flask app service, alongside the output "counter value=..."
- An integrated terminal using ttyd
- A kubernetes visualizer derived from Brendans Burns' live-k8s-visualizer on github

Below is a screenshot showing the application button, and the output showing the current counter value.  Below that we see the apply of flask-deployment.yaml to change the version of the flask-app image, thus provoking a rolling upgrade.

In the visualizer we can see the upgrade happening ... the blue "flask-app:v2" Pods are being started whilst the green "flask-app:v1" Pods are still running.  Once all v2 Pods are deployed the v1 Pods will disappear.




Thanks to the CodeEurope team, and Tomasz, I really hope the event will be on again next year !


No comments:

[Conference - CodeEurope.pl] Developing Micro-services on Kubernetes

In April I had the chance to present at CodeEurope.pl , first in Warsaw on Apr 24th, and then in Wroclaw ("wroslof" was my best at...