2

I have a big application structured with FastAPI (with many routers), that runs in AWS Lambda. I want to migrate it to a container inside Kubernetes. From my research, OpenFaaS is a great solution. However I can't find documentation about how to do this.

Does anyone has references or a better solution?

Bemojo
  • 96
  • 9

2 Answers2

2

If you are using the python or Ruby

You can create the docker file and use it for creating the docker images and simply deploy it on Kubernetes.

FROM ruby:2.7-alpine3.11

WORKDIR /home/app
COPY    .   .

RUN bundle install

CMD ["ruby", "main.rb"]

For OpenFass they have provided good labs with documentation to create the Async function etc.

Labs : https://github.com/openfaas/workshop

If you are looking for examples you can check out the official repo only : https://github.com/openfaas/faas/tree/master/sample-functions

Extra

There is also another good option Knative or Kubeless

You can find the python Kubeless example and CI/CD example : https://github.com/harsh4870/kubeless-kubernetes-ci-cd

Harsh Manvar
  • 27,020
  • 6
  • 48
  • 102
  • 1
    Thanks for the answer! However the solution proposed with Dockerfile does not seem scalable to me. And from the suggested links I didn't see a relationship between OpenFaaS and FastAPI. Perhaps it is best to explore another solution. – Bemojo Sep 09 '21 at 08:08
  • We have FastAPI app deployed using ECS Fargate and CICD runs using AWS CodePipeline. Haven't had any issues with scaling. – tomarv2 Oct 19 '21 at 14:36
1

Try use a template to build an upstream FastAPI application as an OpenFAAS function. This will create a docker image you can run and deploy in your Kubernetes cluster.

You can see how to do so in the following github repo