https://github.com/akaliutau/randomizer
A docker image with simple Flask application to test Kubernetes cluster
https://github.com/akaliutau/randomizer
docker-hub dockerized-app flask kubernetes-cluster python3
Last synced: about 1 month ago
JSON representation
A docker image with simple Flask application to test Kubernetes cluster
- Host: GitHub
- URL: https://github.com/akaliutau/randomizer
- Owner: akaliutau
- License: mit
- Created: 2023-12-30T12:42:04.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-12-31T13:37:45.000Z (over 2 years ago)
- Last Synced: 2025-05-29T15:11:56.570Z (about 1 year ago)
- Topics: docker-hub, dockerized-app, flask, kubernetes-cluster, python3
- Language: Python
- Homepage:
- Size: 7.81 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# About
A docker image with simple Flask application to test Kubernetes cluster.
For example, one can simulate network failure scenarios (via toggling liveness probe) or app failure (using readiness
probe programmable logic). The app contains in-built version and generates a unique UUID on startup
Business logic is simple - the main endpoint returns random number
# Installation
```shell
python3 -m venv venv
source ./venv/bin/activate
pip install -r requirements.txt
```
# Running
To start local server
```shell
# export PORT=8080 - optional
python3 app.py
```
(default port is 8080, since 80 is usually taken by other processes)
# Building image
Test and dev built:
```shell
sudo docker build -t randomizer:1.0 .
sudo docker run randomizer:1.0
```
Note, docker runs images in isolation mode by default and hence you cannot connect to localhost:8080. Use mapping instead:
```shell
docker run -d -p 8080:8080 randomizer:1.0
docker kill
```
Production built:
```shell
docker login -u
docker tag randomizer:1.0 /randomizer:1.0
docker push /randomizer:1.0
```
# API
| endpoint | action |
|---------------------|-----------------------------------|
| / | returns random number |
| /memory-loader?mb=3 | allocates memory buffer in 3 MB |
| /toggle-live | toggles liveness probe |
| /toggle-ready | toggles readiness probe |
| /health | returns 200 OK or 500 Error |
| /info | returns insights about server env |