<p>I am trying to publish my Azure Functions App to Kubernetes but I am getting the following error when I run this command</p>
<p><code>func kubernetes deploy --name my-function-api --namespace default --registry mycontainerregistry/docker-azure-function --csharp</code></p>
<blockquote>
<p>Unable to find project root. Expecting to find one of host.json, local.settings.json in project root.`</p>
</blockquote>
<p>This is my docker file</p>
<pre><code>FROM mcr.microsoft.com/dotnet/sdk:3.1 AS installer-env

COPY . .
RUN cd /MyFunctionApp.Api &amp;&amp; \
    mkdir -p /home/site/wwwroot &amp;&amp; \
    dotnet publish *.csproj --output /home/site/wwwroot

COPY /MyFunctionApp.Api/host.json /home/site/wwwroot
COPY /MyFunctionApp.Api/local.settings.json /home/site/wwwroot

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

COPY --from=installer-env [&quot;/home/site/wwwroot&quot;, &quot;/home/site/wwwroot&quot;]
</code></pre>
<p>As you can see I have tried adding the following lines</p>
<pre><code>COPY /MyFunctionApp.Api/host.json /home/site/wwwroot
COPY /MyFunctionApp.Api/local.settings.json /home/site/wwwroot
</code></pre>
<p>But that does not seem to help either, so not sure what I need to do to get this working?
Any help would be appreciated.</p>

Lenny D
<p>Ok so figured this out. Azure Functions does not read <code>local.settings.json</code> or <code>settings.json</code> when running in a container. These keys need to be set as environment variables.</p>
<p>You need to have the <code>local.settings.json</code> in the the same folder that you run the <code>func kubernetes deploy</code> command from and that will generate a yaml file with the settings that get passed into the container when it is started.</p>
<p>NB: this does not seem to work with setting <code>CORS</code> settings. I have a new question for that here <a href="https://stackoverflow.com/questions/65074215/cors-issue-with-azure-functions-inside-aks-cluster">CORS Issue with Azure Functions inside AKS Cluster</a></p>
