This is the Beiboot API running as a side component for the Beiboot Operator. It wraps the Beiboot Python client (source code) in a REST API using FastAPI.
To get started, you only need a Kubernetes cluster and the Poetry environment.
Basically, any Kubernetes cluster will do. The following describes a local setup using Minikube.
Assuming you have Minikube installed, please run the following on your terminal:
-
Create a Kubernetes cluster using the Docker driver
minikube start --cpus=max --memory=4000 --driver=docker --embed-certs --addons=default-storageclass storage-provisioner
Alternatively you can use k3d:
k3d cluster create getdeck-api --agents 1 -p 8080:80@agent:0 -p 31820:31820/UDP@agent:0
-
The
kubectl
context will be set automatically to this cluster (please check it anyway) -
Create the
getdeck
namespace:kubectl create ns getdeck
. -
Install the Beiboot Operator to this cluster:
kubectl apply -f https://raw.githubusercontent.com/Getdeck/beiboot/main/operator/manifests/beiboot.yaml
-
Store the Minikube kubeconfig for later use in an application container with (working dir is getdeck-api/app/):
kubectl config view --flatten --minify > app/beiboot_api/kubeconfig.yaml
You can delete the Minikube cluster with minikube delete
. Please find the Minikube docs for further assistance above.
First you need to create a container image from the source. Please run:
docker build app/ -t getdeck-api
It's simple to connect Gefyra (0.13.4+) with a Kubernetes cluster.
If used together with Minikube, please follow these steps:
-
Set up Gefyra with:
gefyra up --minikube
❗ If you are using a k3d cluster, omit the
--minikube
option. -
Start a container image locally with (working dir is getdeck-api/app/):
gefyra run -i getdeck-api -n getdeck -N getdeck-api -v $(pwd)/:/app -c "/bin/sh -c 'while sleep 1000; do :; done'" --expose localhost:8001:8000 --detach
Important: Please keep in mind, that you also mount the kubeconfig.yaml for the Minikube cluster. It is needed to make the application able to talk to the Kubernetes API.
-
Confirm the presence of the kubeconfig file:
> docker exec -it getdeck-api bash > du -h kubeconfig.yaml 4.0K kubeconfig.yaml
-
Start the fastapi process with:
> docker exec -it getdeck-api bash > uvicorn main:app --host 0.0.0.0 --reload
-
Find the output on http://localhost:8001
Important: This process is now connected to the Kubernetes API. -
Do the development work!
-
You can remove/restart the container with:
docker rm -f getdeck-api
(build a new container image with new dependencies and start over again)
Build devcontainer:
devcontainer build --no-cache --image-name "getdeck-api:devcontainer" --workspace-folder "."
Start devcontainer using gefyra run:
gefyra run -i getdeck-api:devcontainer -n getdeck -N getdeck-api -v $(pwd):/workspace -c "/bin/sh -c 'while sleep 1000; do :; done'" --expose localhost:8000:8000