Skip to content

PollKube doesn't work at first request #2304

@pietrocarpinacci-dufercodev

Description

Hi, I'm setting up ocelot on a k8s cluster and I noticed that if you set the PollKube service discovery the first requests you receive for that k8s service go to 404 not found all the others after the first it works great also when pods go up and down.
I'm using ocelot version 24.0.1

Configuration to reproduce the problem:

{
  "GlobalConfiguration": {
    "RequestIdKey": "x-correlation-id",
    "ServiceDiscoveryProvider": {
      "Scheme": "https",
      "Host": "kubernetes.docker.internal",
      "Port": 6443,
      "Token": "token",
      "Namespace": "test-ns",
      "Type": "PollKube",
      "PollingInterval": 500
    }
  },
  "Routes": [
    {
      "UpstreamPathTemplate": "/api/{everything}",
      "UpstreamHttpMethod": [
        "Get",
        "Put",
        "Post",
        "Delete",
        "Options"
      ],
      "DownstreamPathTemplate": "/api/v1.0/{everything}",
      "DownstreamScheme": "http",
      "LoadBalancerOptions": {
        "Type": "RoundRobin"
      },
      "ServiceName": "downstream-api-svc"
    }
  ]
}

Add K8s to ocelotBuilder without kubeclint options because it is created from global configuration

var ocelotBuilder = builder.Services
    .AddOcelot(builder.Configuration)
    .AddKubernetes(null, allowInsecure: true);

Could you help me?

Thanks,
Pietro

Metadata

Metadata

Assignees

No one assigned

    Labels

    KubernetesService discovery by KubernetesService DiscoveryOcelot feature: Service DiscoverybugIdentified as a potential bug

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions