Small Demo to show how to deploy on Kubernetes.
The API is a simple FastAPI application.
Create an account on Docker Hub.
# Login to Docker Hub
docker login
# Build the image
docker build -t <your-docker-hub-username>/api-demo:latest .
# Push the image
docker push inoopa/api-demo:latest
If you are on a Mac with M1, M2, M3,... you can use the following command to build & push the image:
docker buildx build --platform linux/amd64 --push -t <your-docker-hub-username>/api-demo:latest .
docker run -p 80:80 <your-docker-hub-username>/api-demo:latest
The Kubernetes manifests are in the kubernetes
folder.
kubectl apply -f kubernetes/manifest.yaml
Then you need to forward the port to your local machine:
kubectl port-forward -n api-demo-namespace service/api-demo-service 8080:80