Hosting Azure Functions containers in Kubernetes with KEDA

Once you have Azure Functions packaged in a custom Docker image, you can also host the container directly in Kubernetes, without relying on the App Service plan.

Kubernetes is the leading container orchestrator, available as a managed service on the major cloud providers. It can be installed on premises or in the cloud, and can also run on small devices, such as a set of Raspberry Pis working as a single entity. More information about Kubernetes can be found at https://azure.microsoft.com/en-us/resources/kubernetes-learning-path/.

If you don't know anything about Kubernetes, then it's better to start by reading a book, such as Mastering Kubernetes (https://www.packtpub.com/eu/virtualization-and-cloud/mastering-kubernetes ), because Kubernetes is a huge topic, and you need to be familiar with its core concepts before you install, configure, and administer it.

Kubernetes is highly modular and pluggable but was not created to handle event-based architectures that can scale from zero to n instances depending on the flow of events.

This is why Microsoft and Red Hat have created KEDA (https://github.com/kedacore/keda). With KEDA and Kubernetes, you can create an infrastructure similar to the one used to run Azure Functions containers in an App Service plan. This is an infrastructure that you can deploy everywhere and over which you have full control. KEDA is open source and free to use.

KEDA and Kubernetes are important for the following scenarios:
  • Deploying and running functions on premises or on other cloud systems (there is no vendor lock-in)
  • When you already have other Kubernetes apps that you're managing and you want to manage only one environment, or to integrate with them (maybe you have a restricted network, app mesh, custom environment, and so on)
  • When you have a specific need for more control (GPU-enabled computing clusters, more knobs, and so on)
  • When you want to scale to zero without the need for keeping your App Service plan running all the time with a minimum of one instance