The purpose of the project is to build a simple python flask based API endpoint.
- Virtualbox installed on the developer's workstation
- Virtualbox used as the vmdriver for minikube
The following API enpoints enabling one to:
- Request project details
EndPoint | Functionality | Actual Route |
---|---|---|
GET /info | Endpoint returns project details in JSON format | /info |
// build a docker image
docker build -t <imageName:version> \
--build-arg PORT=8080
--build-arg LOG_LEVEL=DEBUG
--build-arg DEBUG=True
--build-arg VERSION=$(git describe --tags)
--build-arg COMMIT=$(git log -1 --format=%h) .
// The following commnds can be used to test the image locally
docker run -it -d -p <outsidePort>:<dockerInsidePort> <imageName:version>
curl http://localhost:<outsidePort>/info
// Tag the docker image
docker tag <imageName:version> <public_repository>/<imageName:version>
// Push the docker image
docker push <public_repository>/<imageName:version>
- Start minikube
minikube start --memory=2048 --vm-driver=virtualbox --cpus=2 --kubernetes-version=v1.20.0
- Enable metrics on minikube
minikube addons enable metrics-server
- Create a namespace
kubectl create namespace <name>
- Deploy FlaskAPI temaplate
kubectl apply -f ./k8s-template.yml
- Set minikube IP
export MINIKUBE_HOST=`minikube ip`
- Run curl command to test
curl $MINIKUBE_HOST:30101/info
- Run following command to test HPA
while true; do wget -q -O- curl $MINIKUBE_HOST:30101/info; done