azure-functions-core-tools: Azure Functions Core Tools v4 unable deploy to Kubernetes

G:\Projects\funapp2>func --version
4.0.3928

G:\Projects\funapp2>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?

About this issue

  • Original URL
  • State: open
  • Created 3 years ago
  • Reactions: 13
  • Comments: 16 (3 by maintainers)

Most upvoted comments

I created a PR to resolve this issue inside the functions tooling: #3000

In the meantime, if you want an immediate fix on your project’s side, I also created a helper program that does that. It is published as a NuGet package Az.Functions.MetadataToJson (repo on GitHub)

Just add a reference to it in your project file and it should make the func kubernetes deploy work as expected.

@MACEL94 It seems nobody watching this repo. I reported a few issues that is been stalled for more than 1 month.

It seems that the PR is stale, it is required to have more tests as @FinVamp1 commented. Our deployment is blocked by this issue. Any plans @khkh-ms @michaelpeng36 @AnatoliB to merge the PR in the next weeks or should we move to a full manual deployment?

upvote, i am encountering the same bug

Same issue is also a problem with node

Bump. Also blocked by this.

Just tested it by compiling locally, #3000 fixes the issue for me. Shoutout to @f1x3d, awesome! Do you have any more insight into whether we can expect the PR to be merged anytime soon (apart from the PR conversation)?

@SOFSPEEL The mcr.microsoft.com/azure-functions/dotnet:4 image you mentioned is for non-isolated function apps.

The issue described here only affects isolated functions since the functions.json file is not generated for isolated funcs during the build process, and the current version of CLI tools uses information from this file to generate deploy yaml.

Though the band-aid mentioned above should also work when you’re running isolated functions inside Docker images like mcr.microsoft.com/azure-functions/dotnet-isolated:4-dotnet-isolated6.0