Ocelot icon indicating copy to clipboard operation
Ocelot copied to clipboard

Errors when running Ocelot.Provider.Kubernetes in Azure K8

Open tomfanara opened this issue 3 years ago β€’ 4 comments

Expected Behavior / New Feature

Expect downstream routing to work

Actual Behavior / Motivation for New Feature

404 error

Error Code: UnableToFindServiceDiscoveryProviderError Message: Unable to find service discovery provider for type: consul errors found in ResponderMiddleware. Setting error response for request path:/products/g-ps4, request method: GET

Steps to Reproduce the Problem

  1. routing file { "Routes": [ { "DownstreamPathTemplate": "/home", "DownstreamScheme": "http",

    "UpstreamPathTemplate": "/test", "ServiceName": "productshttpaggegator", "UpstreamHttpMethod": [ "Get" ] }, { "DownstreamPathTemplate": "/api/products/{postId}", "DownstreamScheme": "http",

    "UpstreamPathTemplate": "/products/{postId}", "ServiceName": "productshttpaggegator", "UpstreamHttpMethod": [ "Get" ] },

"GlobalConfiguration",
{
  "ServiceDiscoveryProvider": {
    "Namespace": "apigateway",
    "Type": "kube"
  }
}

] } 2.. APIGateway pod or service configured as LoadBalancer 1.

Specifications

  • Version: Ocelot 17.0.0 and Ocelot.Provider.Kubernetes 17.0.0
  • Platform: Azure Kubernetes cluster
  • Subsystem: .NET 5 API project

tomfanara avatar Oct 17 '21 04:10 tomfanara

I am new to Ocelot on K8 and find the documentation confusing and not clear on proper setup.

tomfanara avatar Oct 17 '21 04:10 tomfanara

@tomfanara nothing is wrong with your configuration, seens to be a bug on Ocelot! I got the same problem when upgrade to 18.0.0, running local on docker works fine on Ocelot 18.0.0 but in K8S cluster none route works, returning 404

ghost avatar Jul 07 '22 14:07 ghost

Any update? Because of this i got stuck on version 14.1.0 when all works

ghost avatar Jul 07 '22 14:07 ghost

Hi Felipe hope all is well. I gave up on Ocelot on K8 but I still use it in dev for Docker Compose. I just use a Ingress Controller in K8 instead and load balance from their and wired in Identity with a JWT. However, I liked the simplicity of Ocelot with DI. I'll be back under the hood soon.

I am not sure they are still supporting Ocelot although Microsoft is endorsing it in their microservices book.

thanks, Tom


From: Felipe LeΓ£o @.> Sent: Thursday, July 7, 2022 9:07 AM To: ThreeMammals/Ocelot @.> Cc: tomfanara @.>; Mention @.> Subject: Re: [ThreeMammals/Ocelot] Errors when running Ocelot.Provider.Kubernetes in Azure K8 (#1527)

Any update? Because of this i got stuck on version 14.1.0 when all works

β€” Reply to this email directly, view it on GitHubhttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FThreeMammals%2FOcelot%2Fissues%2F1527%23issuecomment-1177672750&data=05%7C01%7C%7C980a2fe169ae4948857508da6022093b%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637927996582538536%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=ab8bwUyDudI%2BKK%2FrpIFw7xIGkKYsW1ENSUzb73DWv60%3D&reserved=0, or unsubscribehttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAVQO4I5VDIPPDDVXLRVHLQLVS3QCHANCNFSM5GELPYIA&data=05%7C01%7C%7C980a2fe169ae4948857508da6022093b%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637927996582538536%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=oNT57Hcm5tVi8xeS5Tqs7XfXN1hMG2MpK%2FWD6Z1A9g8%3D&reserved=0. You are receiving this because you were mentioned.Message ID: @.***>

tomfanara avatar Jul 07 '22 18:07 tomfanara

@ggnaegi Yet another the same error. Pairing K8 vs Consul... Maybe load balancer?

raman-m avatar Jan 13 '24 17:01 raman-m

@raman-m Ok, yes, the problem is here https://github.com/ThreeMammals/Ocelot/blob/bb795876c493af958f1d58c852ea56e94263906d/src/Ocelot/ServiceDiscovery/ServiceDiscoveryProviderFactory.cs#L59 The design isn't great and should be addressed in the future. Since the class used for the k8 provider is called KubernetesServiceDiscoveryProvider It will never match kube...

ggnaegi avatar Jan 14 '24 22:01 ggnaegi

@ggnaegi πŸ†— You know this logic better than me. I'm going to accept the bug...


The design isn't great and should be addressed in the future. Since the class used for the k8 provider is called KubernetesServiceDiscoveryProvider. It will never match kube...

Oh, oh! Ups!... Yeap, design is not great. But K8 SD feature works in general, right? But isn't ServiceDiscoveryFinderDelegate responsible for getting correct provider instance? Maybe the author forgot to follow instructions in Kubernetes doc, and adding reference to Ocelot.Provider.Kubernetes package and calling AddKubernetes method? πŸ˜„

raman-m avatar Jan 15 '24 10:01 raman-m

@tomfanara Did you follow the instructions in Kubernetes doc? πŸ˜‰


I am not sure they are still supporting Ocelot although Microsoft is endorsing it in their microservices book.

Seems not endorsing nowadays anymore... 😒 Microsoft has employed a lot of bad boys who like to buy & kill open-source projects which are not under control by Microsoft managers. Ocelot is removed from Microservices Arch book. Microsoft respects its own product. You know the name.

raman-m avatar Jan 15 '24 10:01 raman-m