- create node.js/python/ruby/golang app named “rotator”
1.1. application should have /tag HTTP endpoint
1.2. response from endpoint should be taken from “rotator.json” file with contents:1.3. responses should be returned from Json file based on weighted round robin algorithm, for example, response "a" is assigned a weight of 3 and response "b" a weight of 1, the application returns 3 responses of "a" for each response of "b".[ { "response": "a", "weight": 3 }, { "response": "b", "weight": 1 } ]
- deploy container of rotator app to local k8s cluster
- create app or script named “monitor” in any language of choice to test “rotator” app
3.1. monitor should generate 10000 requests and count responses grouped by body of response in order to verify rotation logic
3.2. run monitor from container and persist results in txt or json file - create README.md with instructions how to deploy rotator app on local k8s cluster with cli "kubectl create -f app-service.yaml, monitor-service.yaml"
- BONUS: deploy nginx reverse proxy for rotator app “kubectl create -f ingress-service.yaml”
- BONUS: configure SSL termination with https://letsencrypt.org
Minikube/Kubernetes or Docker with compose
https://github.com/ay-b/a-b_test
Nginx reverse proxy is working in front of python script
Internet --> [ Kubernetes [ Nginx.pod --> Python.pod ] ]
Rotator works at port 8080, while Nginx listens to 80 and proxying requests to Rotator.
Rotator has a hartbeat URL /heartbeat
which can be adressed by a monitoring system
First variant:
* in the project folder type docker-compose up
* point at localhost
in the browser
Second variant: * ssh to the k8s * type
kubectl create -f rotator-deployment.yaml
kubectl create -f rotator-service.yaml
kubectl create -f nginx-deployment.yaml
kubectl create -f nginx-service.yaml
* if necessary, type `kubectl expose deployment nginx --type=NodePort` to get access from outside
There is a shell script in the "monitor" folder, which can be run at any *nix host. This script does necessary runs against the target host and showing the stats with dropping result to the external log.txt
file.
- replace quick and dirty monitoring script with an automated heartbeat/stats monitor script in a container
- spend a buck to have a place to implement HTTPS with LetsEncrypt