Azure Functions Core Tools v4 unable deploy to Kubernetes

Will 保哥 61 Reputation points
2021-11-09T17:38:29.773+00:00
G:\>func --version
4.0.3928

G:\>dotnet --version
6.0.100

Here are the steps to reproduce the problem.

mkdir funapp2 && cd funapp2
func init --worker-runtime dotnetIsolated --docker
func new -t "HttpTrigger" -n "Login" -a "anonymous"

Modify the Dockerfile file as below:

FROM mcr.microsoft.com/dotnet/sdk:6.0 AS installer-env

COPY . /src/dotnet-function-app
RUN cd /src/dotnet-function-app && \
    mkdir -p /home/site/wwwroot && \
    dotnet publish *.csproj --output /home/site/wwwroot

# To enable ssh & remote debugging on app service change the base image to the one below
# FROM mcr.microsoft.com/azure-functions/dotnet-isolated:3.0-dotnet-isolated5.0-appservice
FROM mcr.microsoft.com/azure-functions/dotnet-isolated:3.0-dotnet-isolated5.0
ENV AzureWebJobsScriptRoot=/home/site/wwwroot \
    AzureFunctionsJobHost__Logging__Console__IsEnabled=true

COPY --from=installer-env ["/home/site/wwwroot", "/home/site/wwwroot"]

Build & Push image

docker build -t willh/funapp2:latest .
docker push willh/funapp2:latest

Deploy my function app with --dry-run

func kubernetes deploy --name funapp2 --service-type NodePort --image-name willh/funapp2 --dry-run

There is only Secret been created.

data:
  AzureWebJobsStorage: VXNlRGV2ZWxvcG1lbnRTdG9yYWdlPXRydWU=
  FUNCTIONS_WORKER_RUNTIME: ZG90bmV0LWlzb2xhdGVk
apiVersion: v1
kind: Secret
metadata:
  name: funapp2
---

Where is the other YAML of the deployment?

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
4,118 questions
0 comments No comments
{count} vote

1 answer

Sort by: Most helpful
  1. Achraf Ben Alaya 801 Reputation points MVP
    2024-03-24T09:43:49.31+00:00

    Hi ,

    To build an image and deploy your functions to Kubernetes, run the following command:

    func kubernetes deploy --name <name-of-function-deployment> --registry <container-registry-username>
    
    

    You can deploy an Azure function to Kubernetes by following the instructions on this link :

    https://learn.microsoft.com/en-us/azure/azure-functions/functions-kubernetes-keda?wt.mc_id=MVP_328341

    https://learn.microsoft.com/en-us/azure/azure-functions/functions-core-tools-reference?tabs=v2#func-kubernetes-deploy?wt.mc_id=MVP_328341

    Hope this helps.

    If the reply is helpful, please click Accept Answer and kindly upvote it. If you have additional questions about this answer, please click Comment.

    0 comments No comments