Skip to content

k8s calculator to solve infamous "multiply two numbers... using Kubernetes" task from job interviews. We are not using the most simple and straightforward way, instead, we use as many hype technologies as possible.

Notifications You must be signed in to change notification settings

banderlog/k8s_calc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

First in class complex post-AI blockchain-less nextgen advanced opensource end-to-end scalable multicloud SaaS smart product for high-loaded secure high performance computing systems

globohomo art style

Powered with cutting edge Foretold Termination™ technology (saves time on container unload), famous "less than 10 seconds" calculator on kubernetes.

Prerequisites

Installation and usage

kind cluster with ingress preparation:

# cluster creation with `kind`
kind create cluster --config=./kind.yaml

# ingress NGINX controller
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/main/deploy/static/provider/kind/deploy.yaml

# wait until is ready to process requests running
kubectl wait --namespace ingress-nginx \
  --for=condition=ready pod \
  --selector=app.kubernetes.io/component=controller \
  --timeout=90s

k8-calc installation:

# installation
helm install k8-calc k8-calc/

# verification -- should output "69"
curl localhost/k8_calc

For different calculation you have two options:

  1. re-deploy with new expression argument
    • helm install k8-calc k8-calc/ --set expression=%your_expression%
    • check localhost/k8_calc
  2. change ConfigMap inside current deployment
    • run kubectl edit configmap calculateme-configmap
    • change calculateme: 60+9 line, save and exit text editor
    • check localhost/k8_calc

To remove everything:

  • run kind delete cluster

How it works

  • There is env string variable calculateme defined in the ConfigMap
  • A busybox pod runs it through bc, writes an answer to a file in the mounted volume and dies
  • A nginx pod mounts this file as index.html, so it is accessible via an HTTP request
  • The Reloader watches ConfigMap and restarts busybox pod if it changed

About

k8s calculator to solve infamous "multiply two numbers... using Kubernetes" task from job interviews. We are not using the most simple and straightforward way, instead, we use as many hype technologies as possible.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published