protoactor-dotnet icon indicating copy to clipboard operation
protoactor-dotnet copied to clipboard

Kubernetes Provider on pod hostNetwork enabled

Open rendy-w opened this issue 9 months ago • 1 comments

Hi, I've encountered issue running Proto Cluster when the pod hostNetwork: true while using kubernetes provider.

this is the log:

[Proto.Cluster.Kubernetes.KubernetesProvider] [Cluster][KubernetesProvider] Registering service ip-10-0-2-223 on 10.0.2.223:8
[Proto.Cluster.Kubernetes.KubernetesProvider] Failed to register service
    k8s.Autorest.HttpOperationException: Operation returned an invalid status code 'NotFound'                                                                                                              
        at k8s.Kubernetes.SendRequestRaw(String requestContent, HttpRequestMessage httpRequest, CancellationToken cancellationToken)
        at k8s.Kubernetes.ReadNamespacedPodWithHttpMessagesAsync(String name, String namespaceParameter, Nullable`1 pretty, IDictionary`2 customHeaders, CancellationToken cancellationToken)
       at k8s.KubernetesExtensions.ReadNamespacedPodAsync(IKubernetes operations, String name, String namespaceParameter, Nullable`1 pretty, CancellationToken cancellationToken) 
       at Proto.Cluster.Kubernetes.KubernetesProvider.RegisterMemberInner()                                                                                                                                
       at Proto.Utils.Retry.Try(Func`1 body, Int32 retryCount, Int32 backoffMilliSeconds, Int32 maxBackoffMilliseconds, Action`2 onError, Action`1 onFailed, Boolean ignoreFailure) 

any idea on how to fix this?

rendy-w avatar Sep 04 '23 10:09 rendy-w

I'm guessing now, but it might be that we are unable to talk to the Kubernetes API, e.g. that we should use some other configuration for the Kubernetes API client when using hostNetwork. but given that it gets status not found at least hints that we are calling a non existing endpoint.

If that is the case, we should probably add some setting for HostNetwork in here: https://github.com/asynkron/protoactor-dotnet/blob/dev/src/Proto.Cluster.Kubernetes/KubernetesProviderConfig.cs

And then make it use that setting to figure out where to make the client call when talking to the K8s API

rogeralsing avatar Sep 04 '23 10:09 rogeralsing