This platform should provide deployment of python services to k8s with ZERO
effort.
- Pack your service in Docker and built it using buildah library
- Push the image to registry
- Deploy Knative Service in k8s
- You get address of deployed service so you can access it easily
- Knative enables routing, autoscaling, revisioning..
- kubectl
- minicube with Knative (follow this guide - https://knative.dev/docs/getting-started/)
- buildah (instll buildah using $sudo dnf -y install buildah )
- sed
- python3
minikube start -p knative
minikube tunnel --profile knative
export USERNAME='registry-username'
export PASSWORD='registry-password'
export KUBECONFIG='path/to/kubernetes/with/knative' (please check context!!!)
- clone repo
- $cd Builder
- python3 -m venv
- source ./bin/activate
- pip install -r requirements
- run app.js
Builder should be up & running on http://0.0.0.0:8080/docs#/ .
There is a few REST endpoints defined. For us, most interesting is POST /code
.
Get the body from example-code-body.json and put it in body of POST /code
in swagger. Execute !!!
After less then ~2-3 mins, your app defined in "code" section of body will be deployed in k8s.
As a result of POST /code
you'll get an object with address
propery, use that address to access deployed service (address/docs) .
This service has been tested on linux (Fedora)