Run using kubernetes / minikube
Installation / Starting Minikube (tested for windows)
Install Chocolatey
Install Minikube Minikube
choco install minikube
Install kubectl kubectl
choco install kubernetes-cli
Install kubernetes-kompose
choco install kubernetes-kompose
- (If kubernetes files not existing): Create Kubernetes Configuration Files.
This will generate a folder called minikube with all the kubernetes configuration files based on the cocker-compose. However this might overwrite custom changes made to the files, if already existing. Proceed with caution.
kompose convert -f docker-compose.yaml --out minikube
Start Docker (e.g. Docker Desktop)
Start minikube
minikube start
- Set minikube as docker env
Minkube needs to be set as docker environment to be able to build images for minikube. Otherwise Minikube would not be able to find the images. This needs to be done every time a new terminal is opened.
minikube docker-env | Invoke-Expression
Build qunicorn image
docker build -t qunicorn:local .
Start services and pods with configuration
kubectl apply -f minikube
Expose qunicorn through minikube (start in another terminal) Exposes the qunicorn service to the internet. This is needed to be able to access the service from outside the cluster.
minikube tunnel
List service information using
kubectl get svc
Get existing pos and fill database with data
kubectl get po --selector=io.kompose.service=server
kubectl exec {name of server pod} -- python -m flask create-and-load-db
Now you can access qunicorn using [EXTERNAL-IP]:8080/swagger-ui of the server service
Other useful commands
Clear all kubectl pods and services
kubectl delete daemonsets,replicasets,services,deployments,pods,rc,ingress --all --all-namespaces
Expose service and create Tunnel
minikube service {service}