- To run the tests:
- requirements:
- Python ^3.8
- Poetry
- requirements:
poetry shell
poetry install
pytest
-
-
Clone this repo and navigate to the root project folder
todoapi-k8s. -
Start the cluster by running:
minikube start -
To point your shell to minikube’s docker-daemon, run:
eval $(minikube -p minikube docker-env)That way we can use our local docker images, without having to pull them from the docker hub:
-
Now build the image in the Dockerfile:
docker build . -t test-k8s/todoapp -
Apply a configuration to a resource by file name for pods generation:
kubectl apply -f deployment.yml -
Finally run the following commands to list your application's pods and services:
kubectl get pods kubectl get svcThe following command will display the URL where your application is running, copy it and access it in your browser at the
/docsendpoint:minikube service listNow you can interact with the API!
-
NOTE: We are using only one replica of the application because SQLite is being used
To view the logs, run the following command passing the name of your pod:
kubectl logs <name-of-the-pod-here>