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
Navigate to the location where the docker-compose file is. It should be under ‘C:...qunicorn-core’.
Now check if a minikube folder has been created under ‘C:...qunicorn-core’. If not, create the kubernetes configuration files. This will generate a folder called minikube with all the kubernetes configuration files based on the docker-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
Minikube 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
You can also load local images into Minikube with
minikube image load {image-name}
Build qunicorn image
docker build -t qunicorn:local .
Start services and pods with configuration (Note that starting the whole cluster can take a while (up or more than 8min))
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
Alternatively, you can access the qunicorn service with the following command.
minikube service qunicorn
List service information using
kubectl get svc
Get existing pos and fill database with data
kubectl get po --selector=io.kompose.service=server
Now you can access qunicorn using [EXTERNAL-IP]:8080/swagger-ui of the server service (usually you can use localhost)
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}
Visual dashboard to view cluster information
minikube dashboard
A tutorial on how to deploy the helm charts
helm installation
Helm must be installed to use the charts. Please refer to Helm’s documentation to get started.
Once Helm has been set up correctly, then we need:
To install the <chart-name> chart:
cd <helm-chart-folder>
helm install <my-chart-name> .
To uninstall the chart:
helm delete <my-chart-name>
Converting YAML files into helm charts
Using helmify
Installation of helmify
Convert YAML files to Helm chart
For single yaml file:
cat <your-yamlfile-name>.yaml | helmify <chart-name>
From directory with yamls:
`awk 'FNR==1 && NR!=1 {print "---"}{print}' /<my_directory>/*.yaml | helmify <helmchart-folder-name>`