Issue in calling Krakend multiple backend host - Load balancing not happening incase of failed host

16 views
Skip to first unread message

Nithya Ravindran

unread,
Oct 27, 2025, 6:54:26 AMOct 27
to KrakenD Community
Hi There,

I am using Krakend Community edition V2.11.0. I am setting up my API gateway where I want to LoadBalance my backend hosts. I have 2 different Backend host ips. To test it, I try to stop one host and try to hit the API. 

Expected :- Krakend should not hit the failing host rather it should hit the healthy one.

Actual:- Krakend sends the requests to both healthy & failing hosts and return the 200 response from health host and returns the 500 error from the failing host . How to get rid of this.

Is it not possible for Krakend to hit the Health backend host all the time whenever there is failure from other host.

Below is the endpoint configuration for the reference.

{
      "endpoint": "/api/doctors-list/",
      "method": "GET",
      "output_encoding": "no-op",
      "backend": [
        {
      "url_pattern": "/himes/api/doctors",
      "method": "GET",
      "encoding": "no-op",
      "host": [
        "http://192.168.20.152:782",
        "http://192.168.20.10:782"
      ],
      "extra_config": {
        "modifier/lua-proxy": {
          "allow_open_libs": true,
          "live": true,
          "post": "logToDb(request.load(), response.load());",
          "sources": ["./lua/trace_inject.lua", "./lua/log_to_db.lua"]
        }
      }
    }
      ],
      "input_query_strings": [
        "LocationID",
        "webServicekey"
      ],
      "input_headers": [
        "*"
      ],
      "extra_config": {
        "qos/http-cache": {
                    "shared": true
                },
        "documentation/openapi": {
          "description": "Get Doctors List for the facility/branch",
          "parameters": [
            {
              "description": "Branch Code",
              "in": "query_string",
              "name": "LocationID",
              "required": true,
              "type": "string"
            },
            {
              "description": "API Key for the client/build",
              "in": "query_string",
              "name": "webServicekey",
              "required": true,
              "type": "string"
            }
          ],
          "summary": "Get Doctors List for the facility/branch",
          "tags": [
            "Okadoc"
          ]
        },
        "modifier/lua-proxy": {
          "allow_open_libs": true,
          "live": true,
          "pre": "inject_endpoint_header();",
          "sources": [
            "./lua/inject_endpoint_header.lua"
          ]
        }
      }
    }

Thanks,
Nithya R

Daniel Ortiz

unread,
Oct 28, 2025, 7:37:29 AMOct 28
to Nithya Ravindran, KrakenD Community
Hi Nithya,

KrakenD load balancing doesn't check for healthy hosts; that should be the responsibility of another layer (e.g., a Service Discovery, a Load Balancer with health checks, ...).

Best regards,
Daniel Ortiz Daniel Ortiz
CIO
KrakenD Logo
LinkedIn icon  Twitter icon
Confidentiality Notice: This email, including any attachments, may contain confidential and privileged information for the sole use of the intended recipient(s). Any unauthorized review, use, disclosure, or distribution is prohibited. If you are not the intended recipient, please contact the sender immediately and destroy all copies of this email. Thank you. This email has been sent in accordance with the European Union General Data Protection Regulation (EU GDPR).


--
You received this message because you are subscribed to the Google Groups "KrakenD Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to community+...@krakend.io.
To view this discussion visit https://groups.google.com/a/krakend.io/d/msgid/community/86b7d662-504f-4c15-8ebe-b28747bf9178n%40krakend.io.

Nithya Ravindran

unread,
Oct 30, 2025, 2:41:29 AMOct 30
to KrakenD Community, Daniel Ortiz, KrakenD Community, Nithya Ravindran
Hi Daniel,

Thank you for your assistance.

I have a question regarding the use of an external load balancer with health checks or service discovery. How can I effectively trace requests handled by KrakenD, from the moment a request is received to when it is sent to the backend servers(which servers handles the incoming request)?

Additionally, if KrakenD does not perform health checks, could you explain how DNS SRV-based service discovery operates internally?

Best regards,
Nithya Ravindran
Reply all
Reply to author
Forward
0 new messages