smrowley / koncepts

A Python Flask app for demonstrating Kubernetes concepts
GNU General Public License v3.0
9 stars 1 forks source link

Koncepts

example workflow

Image is hosted on quay.io

Koncepts is an application for exercising Kubernetes concepts to newer Kubernetes users, as well as testing various configurations.

A Python Flask application that displays /etc/hostname and other info about the host as an html page. When the application is deployed in k8s, this will be the pod name and other pod info.

The app may be helpful for demos of pod deployments, scaling, deletions, etc.

The service is a Flask Python app running on gunicorn. It is using a Jinja template for the index.html. Please forgive the messy html with inline styles and such.

Deploying the app

You can quickly deploy the app in k8s with the following after cloning the repo:

kubectl apply -k kube/base

Example: Deploy with config files mounted as volume

kubectl apply -k kube/overlays/with-config-files

Example: Deploy with LoadBalancer service ingress

kubectl apply -k kube/overlays/expose-lb

Example: Deploy with Ingress configured for Traefik

kubectl apply -k kube/overlays/expose-traefik

Index page

The index URL returns an html page that provides information about the container.

Command line inspection

The app will also handle requests to any path, log the request, and provide a response.

Query Parameters

There are also a few query parameters that you can specify to will cause various status codes and messages to be given in the reponse:

Curl loop for testing

The following is an example script that will curl the app at one second intervals and return the pod name. This can be used to demonstrate the effects of pod scaling with ReplicaSets or Deployment rollouts.

while [ true ]
do
  curl '$HOSTNAME/test?startup_delay=8&failure_delay=45&readiness_period=10&readiness_duration=5'
  sleep 1
done