You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/azure-functions/functions-kubernetes-keda.md
+18-20Lines changed: 18 additions & 20 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,9 +17,9 @@ The Azure Functions runtime provides flexibility in hosting where and how you wa
17
17
18
18
## How Kubernetes-based functions work
19
19
20
-
The Azure Functions service is made up of two key components: a runtime and a scale controller. The Functions runtime runs and executes your code. The runtime includes logic on how to trigger, log, and manage function executions. The Azure Functions runtime can run *anywhere*. The other component is a scale controller. The scale controller monitors the rate of events that are targeting your function, and proactively scales the number of instances running your app. To learn more, see [Azure Functions scale and hosting](functions-scale.md).
20
+
The Azure Functions service is made up of two key components: a runtime and a scale controller. The Functions runtime runs and executes your code. The runtime includes logic on how to trigger, log, and manage function executions. The Azure Functions runtime can run *anywhere*. The other component is a scale controller. The scale controller monitors the rate of events that are targeting your function, and proactively scales the number of instances running your app. To learn more, see [Azure Functions scale and hosting](functions-scale.md).
21
21
22
-
Kubernetes-based Functions provides the Functions runtime in a [Docker container](functions-create-container-registry.md) with event-driven scaling through KEDA. KEDA can scale in to 0 instances (when no events are occurring) and out to *n* instances. It does this by exposing custom metrics for the Kubernetes autoscaler (Horizontal Pod Autoscaler). Using Functions containers with KEDA makes it possible to replicate serverless function capabilities in any Kubernetes cluster. These functions can also be deployed using [Azure Kubernetes Services (AKS) virtual nodes](/azure/aks/virtual-nodes-cli) feature for serverless infrastructure.
22
+
Kubernetes-based Functions provides the Functions runtime in a [Docker container](functions-create-container-registry.md) with event-driven scaling through KEDA. KEDA can scale in to zero instances (when no events are occurring) and out to *n* instances. It does this by exposing custom metrics for the Kubernetes autoscaler (Horizontal Pod Autoscaler). Using Functions containers with KEDA makes it possible to replicate serverless function capabilities in any Kubernetes cluster. These functions can also be deployed using [Azure Kubernetes Services (AKS) virtual nodes](/azure/aks/virtual-nodes-cli) feature for serverless infrastructure.
23
23
24
24
## Managing KEDA and functions in Kubernetes
25
25
@@ -31,33 +31,31 @@ To run Functions on your Kubernetes cluster, you must install the KEDA component
31
31
32
32
## Deploying a function app to Kubernetes
33
33
34
-
You can deploy any function app to a Kubernetes cluster running KEDA. Since your functions run in a Docker container, your project needs a Dockerfile. You can create a Dockerfile by using the [`--docker` option][func init] when calling `func init` to create the project. If you forgot to do this, you can always call `func init` again from the root of your Functions project, this time using the [`--docker-only` option][func init], as shown in the following example.
34
+
You can deploy any function app to a Kubernetes cluster running KEDA. Since your functions run in a Docker container, your project needs a Dockerfile. You can create a Dockerfile by using the [`--docker` option][func init] when calling `func init` to create the project. If you forgot to create your Dockerfile, you can always call `func init` again from the root of your code project.
35
35
36
-
```command
37
-
func init --docker-only
38
-
```
39
-
40
-
To learn more about Dockerfile generation, see the [`func init`][func init] reference.
36
+
1. (Optional) If you need to create your Dockerfile, use the [`func init`][func init] command with the `--docker-only` option:
41
37
42
-
To build an image and deploy your functions to Kubernetes, run the following command:
To learn more about Dockerfile generation, see the [`func init`][func init] reference.
47
43
48
-
In this example, replace `<name-of-function-deployment>` with the name of your function app.
44
+
1. Use the [`func kubernetes deploy`](functions-core-tools-reference.md#func-kubernetes-deploy) command to build your image and deploy your containerized functionapp to Kubernetes:
1. The Dockerfile created earlier is used to build a local image for the function app.
53
-
1. The local image is tagged and pushed to the container registry where the user is logged in.
54
-
1. A manifest is created and applied to the cluster that defines a Kubernetes `Deployment` resource, a `ScaledObject` resource, and `Secrets`, which includes environment variables imported from your `local.settings.json` file.
50
+
In this example, replace `<name-of-function-deployment>` with the name of your functionapp. The deploy command performs these tasks:
55
51
56
-
To learn more, see the [`func kubernetes deploy` command](functions-core-tools-reference.md#func-kubernetes-deploy).
52
+
+ The Dockerfile created earlier is used to build a local image for your containerized functionapp.
53
+
+ The local image is tagged and pushed to the container registry where the user is logged in.
54
+
+ A manifest is created and applied to the cluster that defines a Kubernetes `Deployment` resource, a `ScaledObject` resource, and `Secrets`, which includes environment variables imported from your `local.settings.json` file.
57
55
58
56
### Deploying a function app from a private registry
59
57
60
-
The above flow works for private registries as well. If you are pulling your container image from a private registry, include the `--pull-secret` flag that references the Kubernetes secret holding the private registry credentials when running `func kubernetes deploy`.
58
+
The previous deployment steps work for private registries as well. If you're pulling your container image from a private registry, include the `--pull-secret` flag that references the Kubernetes secret holding the private registry credentials when running `func kubernetes deploy`.
61
59
62
60
## Removing a function app from Kubernetes
63
61
@@ -89,7 +87,7 @@ KEDA has support for the following Azure Function triggers:
89
87
90
88
### HTTP Trigger support
91
89
92
-
You can use Azure Functions that expose HTTP triggers, but KEDA doesn't directly manage them. You can leverage the KEDA prometheus trigger to [scale HTTP Azure Functions from 1 to *n* instances](https://dev.to/anirudhgarg_99/scale-up-and-down-a-http-triggered-function-app-in-kubernetes-using-keda-4m42).
90
+
You can use Azure Functions that expose HTTP triggers, but KEDA doesn't directly manage them. You can use the KEDA prometheus trigger to [scale HTTP Azure Functions from one to `n` instances](https://dev.to/anirudhgarg_99/scale-up-and-down-a-http-triggered-function-app-in-kubernetes-using-keda-4m42).
93
91
94
92
## Next Steps
95
93
For more information, see the following resources:
0 commit comments