The application uses the Python client for Kubernetes and to use it, the correct credentials and cluster information for the master node have to be loaded.
sudo cat /etc/rancher/k3s/k3s.yaml > ~/.kube/configkubectl config view --raw > ~/.kube/configTo run the Elasticity FastAPI application locally for debug purposes, use the following command:
uvicorn --app-dir src app:elasticity_app --reloadTo build the application locally using Docker, follow these steps:
-
Build the Docker image:
docker build -t elasticity-app -f src/Dockerfile . -
Run the Docker container:
sudo docker run -d -p 8000:8000 elasticity-app
To build a multi-architecture Docker image and push it to DockerHub, use the following command:
sudo docker buildx build --platform linux/amd64,linux/arm64 -t <username>/<docker-image-name> -f src/Dockerfile . --pushReplace <username> and <docker-image-name> with your DockerHub username and the desired image name, respectively.