OrleansContrib / Orleans.Clustering.Kubernetes

Orleans Membership provider for Kubernetes
MIT License
188 stars 47 forks source link

Got "Could not load type 'k8s.Models.V1ObjectMeta' from assembly KubernetesClient" exception if using in FSharp Orleans Project #66

Open clement128 opened 1 year ago

clement128 commented 1 year ago

Hi there,

I was just tried to use version 2.1.0 in my fsharp project with orleans 3.7, but I got Could not load type 'k8s.Models.V1ObjectMeta' from assembly KubernetesClient exception when the application startup. Does anyone encountered similar issue? thanks

[02:05:40 ERR] Lifecycle start canceled due to errors at stage 8000: System.TypeLoadException: Could not load type 'k8s.Models.V1ObjectMeta' from assembly 'KubernetesClient, Version=11.0.0.0, Culture=neutral, PublicKeyToken=null'.
   at Orleans.Clustering.Kubernetes.KubeMembershipTable.TryInitClusterVersion()
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine)
   at Orleans.Clustering.Kubernetes.KubeMembershipTable.TryInitClusterVersion()
   at Orleans.Clustering.Kubernetes.KubeMembershipTable.InitializeMembershipTable(Boolean tryInitTableVersion)
   at Orleans.Runtime.MembershipService.MembershipTableManager.Start() in /_/src/Orleans.Runtime/MembershipService/MembershipTableManager.cs:line 164
   at Orleans.Runtime.MembershipService.MembershipTableManager.<>c__DisplayClass54_0.<<Orleans-ILifecycleParticipant<Orleans-Runtime-ISiloLifecycle>-Participate>g__OnRuntimeGrainServicesStart|0>d.MoveNext() in /_/src/Orleans.Runtime/MembershipService/MembershipTableManager.cs:line 859
tobbin2 commented 1 year ago

Have the same issue, it feels like it has to do with using the correct versions on orleans and kubernetes client. But i can't find any docs regarding that

slonopotamus commented 1 year ago

You need to downgrade KubernetesClient to 6.x.

If your app uses Microsoft.Orleans.Hosting.Kubernetes, it can pull in a newer KubernetesClient. So, downgrade Microsoft.Orleans.Hosting.Kubernetes to <= 3.5.1.

tobbin2 commented 1 year ago

Aah nice thanks, had to add kubernetesClient nuget also manually with that version. For some reason did it decide to use v7.2.0. Got another error so hopefully it will work soon 👍


EDIT

Never mind, it didn't work, well i got this error when upgrading kubernetes to 1.25, i get the feeling that the configuration error other packages has had regarding getting kubernetes container ID is the main issue for me. I however don't use F-Sharp, i use .net 5.0 so this might be another thread for this question?