Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Errors when running Ocelot.Provider.Kubernetes in Azure K8 #1527

Closed
tomfanara opened this issue Oct 17, 2021 · 8 comments · Fixed by #1954
Closed

Errors when running Ocelot.Provider.Kubernetes in Azure K8 #1527

tomfanara opened this issue Oct 17, 2021 · 8 comments · Fixed by #1954
Labels
bug Identified as a potential bug Kubernetes Service discovery by Kubernetes merged Issue has been merged to dev and is waiting for the next release Nov'23 November 2023 release Service Discovery Ocelot feature: Service Discovery

Comments

@tomfanara
Copy link

tomfanara commented Oct 17, 2021

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"
      }
    }
  ]
}
  1. API Gateway pod or service configured as LoadBalancer

Specifications

  • Version: Ocelot 17.0.0 and Ocelot.Provider.Kubernetes 17.0.0
  • Platform: Azure Kubernetes cluster
  • Subsystem: .NET 5 API project
@tomfanara
Copy link
Author

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

@ghost
Copy link

ghost commented Jul 7, 2022

@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
Copy link

ghost commented Jul 7, 2022

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

@tomfanara
Copy link
Author

tomfanara commented Jul 7, 2022 via email

@raman-m
Copy link
Member

raman-m commented Jan 13, 2024

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

@ggnaegi
Copy link
Member

ggnaegi commented Jan 14, 2024

@raman-m Ok, yes, the problem is here

if (provider.GetType().Name.ToLower() == config.Type.ToLower())

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...

@raman-m
Copy link
Member

raman-m commented Jan 15, 2024

@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 raman-m added bug Identified as a potential bug accepted Bug or feature would be accepted as a PR or is being worked on help wanted Not actively being worked on. If you plan to contribute, please drop a note. medium effort Likely a few days of development effort labels Jan 15, 2024
@raman-m
Copy link
Member

raman-m commented Jan 15, 2024

@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 raman-m added Service Discovery Ocelot feature: Service Discovery Kubernetes Service discovery by Kubernetes and removed help wanted Not actively being worked on. If you plan to contribute, please drop a note. medium effort Likely a few days of development effort labels Feb 10, 2024
@raman-m raman-m added the Nov'23 November 2023 release label Feb 10, 2024
@raman-m raman-m added this to the Nov-December'23 milestone Feb 10, 2024
raman-m added a commit that referenced this issue Feb 12, 2024
… discovery provider (#1954)

* Update kubernetes.rst

The `Type` field for the kubernetes example is outdated

* Rename the class back to `Kube` making it as default K8s provider

* Endpoint mocking for `GetAsync()` of `Kube` provider

* Switch off timer

* Update K8s docs

* IDE1006: Naming rule violation

* Follow .NET conventions for test class names

---------

Co-authored-by: Raman Maksimchuk <dotnet044@gmail.com>
@raman-m raman-m added merged Issue has been merged to dev and is waiting for the next release and removed accepted Bug or feature would be accepted as a PR or is being worked on labels Feb 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Identified as a potential bug Kubernetes Service discovery by Kubernetes merged Issue has been merged to dev and is waiting for the next release Nov'23 November 2023 release Service Discovery Ocelot feature: Service Discovery
Projects
None yet
3 participants