Giter Site home page Giter Site logo

vrgitplus / koncepts Goto Github PK

View Code? Open in Web Editor NEW

This project forked from smrowley/koncepts

0.0 0.0 0.0 75 KB

A Python Flask app for demonstrating Kubernetes concepts

License: GNU General Public License v3.0

Python 24.05% HTML 66.21% Dockerfile 9.74%

koncepts's Introduction

Koncepts

example workflow

Image is hosted on Docker Hub

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 two query parameters that you can specify:

  • d parameter looks for a positive integer value, and represents the number of seconds after the python app has started before it will return 200 responses. Until that time, it will return 503 response codes.
    • eg. http://<route url>/test?d=10 will return 503 responses for 10 seconds
    • Default value is 0
  • f parameter works similar to d, but will return 500 status codes after the integer value in seconds beyond the python app starting.
    • eg. http://<route url>/test?f=10 will return 500 responses after the first 10 seconds of the app being started.
    • Default value is 0
    • Note: this parameter is absolute, and has no effect from the value set by d.
      • Example: http://<route url>/test?d=10&f=10 will never return a 200 response. Only 503 prior to 10 seconds, and 500 after 10 seconds has lapsed.

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 http://<route url>/test?d=10
  sleep 1
done

koncepts's People

Contributors

smrowley 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.