Azure / azure-functions-host

The host/runtime that powers Azure Functions
https://functions.azure.com
MIT License
1.92k stars 442 forks source link

Deploying to K8s #10266

Closed neadtree closed 1 month ago

neadtree commented 2 months ago

Is your question related to a specific version? If so, please specify:

no

What language does your question apply to? (e.g. C#, JavaScript, Java, All)

c#

Question

I am trying to containerize my azure durable functions in K8s. ). I am running into the below failure. I noticed https://github.com/Azure/azure-functions-host/blob/dev/src/WebJobs.Script/Host/Kubernetes/KubernetesClient.cs#L61 that uses some type of env var called HTTP_LEADER_ENDPOINT. Do you have any ideas/insights to the error? Should I set env var HTTP_LEADER_ENDPOINT to something? If so, what should I set it to.

The listener for function 'Functions.TimeStarter' was unable to start. Microsoft.Azure.WebJobs.Host.Listeners.FunctionListenerException: The listener for function 'Functions.TimeStarter' was unable to start. ---> System.NotSupportedException: The 'file' scheme is not supported. at System.Net.Http.HttpClient.g__Core|83_0(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationTokenSource cts, Boolean disposeCts, CancellationTokenSource pendingRequestsCts, CancellationToken originalCancellationToken) at Microsoft.Azure.WebJobs.Script.KubernetesClient.TryAcquireLock(String lockId, String ownerId, TimeSpan lockPeriod, CancellationToken cancellationToken) in /src/azure-functions-host/src/WebJobs.Script/Host/Kubernetes/KubernetesClient.cs:line 64 at Microsoft.Azure.WebJobs.Script.KubernetesDistributedLockManager.TryLockAsync(String account, String lockId, String lockOwnerId, String proposedLeaseId, TimeSpan lockPeriod, CancellationToken cancellationToken) in /src/azure-functions-host/src/WebJobs.Script/Host/Kubernetes/KubernetesDistributedLockManager.cs:line 54 at Microsoft.Azure.WebJobs.Host.SingletonManager.TryLockAsync(String lockId, String functionInstanceId, SingletonAttribute attribute, CancellationToken cancellationToken, Boolean retry) in D:\a_work\1\s\src\Microsoft.Azure.WebJobs.Host\Singleton\SingletonManager.cs:line 113 at Microsoft.Azure.WebJobs.Host.Listeners.SingletonListener.StartAsync(CancellationToken cancellationToken) in D:\a_work\1\s\src\Microsoft.Azure.WebJobs.Host\Singleton\SingletonListener.cs:line 48 at Microsoft.Azure.WebJobs.Host.Listeners.FunctionListener.StartAsync(CancellationToken cancellationToken, Boolean allowRetry) in D:\a_work\1\s\src\Microsoft.Azure.WebJobs.Host\Listeners\FunctionListener.cs:line 68

kshyju commented 2 months ago

@AmeyaRele Could you please take a look at this?

kshyju commented 2 months ago

@vivekjilla FYI

krishnajaju commented 2 months ago

Hi @neadtree, do you have POD_NAMESPACE environment variable in functions pod running in K8S? If yes, can you please remove POD_NAMESPACE environment variable and validate if it fixes the issue? Additionally, can you also set WEBSITE_SITE_NAME environment variable to a FunctionApp name since you are running functions in Kubernetes?

neadtree commented 1 month ago

Yes, @krishnajaju I had POD_NAMESPACE environment variable defined. After removing this and adding WEBSITE_SITE_NAME, all started to work, Thank you very much :).

neadtree commented 1 month ago

Issue has been resolved.