hashicorp / consul

Consul is a distributed, highly available, and data center aware solution to connect and configure applications across dynamic, distributed infrastructure.
https://www.consul.io
Other
28.29k stars 4.42k forks source link

Configure MaxFailures on Ingress Gateway #12932

Open Joxit opened 2 years ago

Joxit commented 2 years ago

Question

Hi there.

TLDR; How to configure MaxFailures or envoy consecutive_5xx of Ingress Gateway ?

I'm using consul for years and now I want to use it with Kubernetes. I'm working with services inside and outside Kubernetes, so I must use the Ingress Gateway for the communication. The issue with Ingress Gateway (and envoy dynamic configuration) is the default consecutive 5xx configuration. This is irrelevant in our use and degrades our performance when returning 5xx. After 5 consecutive 5xx from a backend, envoy returns this message: no healthy upstream.

I check the consul main repository and found this issue https://github.com/hashicorp/consul/issues/11422 but this did not work (maybe because we should use ProxyDefaults for Ingress Gateway?).

I also checked the documentation for ProxyDefaults Kubernetes YAML with the link to envoy proxy config options and saw this key passive_health_check but did not understand if I can and where I can add this in the proxy defaults configuration...

In my example bellow, the service returns the wanted status code curl http://127.0.0.1:8080/status?code=500 will return a status 500 code.

CLI Commands (consul-k8s, consul-k8s-control-plane, helm)

helm upgrade --install --version 0.39.0 --create-namespace -n consul --set global.name=consul -f values.yaml consul hashicorp/consul

Helm Configuration

Steps to reproduce this issue, eg:

  1. When running helm install with the following values.yaml:
    
    global:
    datacenter: 'dc1'
    tls:
    enabled: false
    acls:
    manageSystemACLs: false
    image: 'hashicorp/consul:1.11.1'
    imageEnvoy: 'envoyproxy/envoy-alpine:v1.20.0'
    imageK8S: 'hashicorp/consul-k8s-control-plane:0.39.0'
    metrics:
    enabled: false
    meshGateway:
    enabled: false

ingressGateways: enabled: true defaults: replicas: 1 service: ports:

Logs

When I check the ingress-gateway config dump (http://127.0.0.1:19000/config_dump), where is what I found, outlier_detection still empty:

kubectl port-forward -n consul consul-ingress-gateway-5d9dc99bbd-shw5r 19000
curl http://127.0.0.1:19000/config_dump
     {
          "version_info": "ea72e0ee8944a6e8a3d74828cd48c542dfbb8c70b59be52e83d4d0159f18e4af",
          "cluster": {
            "@type": "type.googleapis.com/envoy.config.cluster.v3.Cluster",
            "name": "statuscode.default.dc1.internal.0ad86cd7-4cfa-e946-8f67-b920776a6757.consul",
            "type": "EDS",
            "eds_cluster_config": {
              "eds_config": {
                "ads": {},
                "resource_api_version": "V3"
              }
            },
            "connect_timeout": "5s",
            "circuit_breakers": {},
            "outlier_detection": {},

You can access the Ingress Gateway on your computer on port 30000, send 6 times this request:

curl -H 'Host: statuscode.ingress.consul' http://<ingress-gateway-ip>:30000/status?code=500

Current understanding and Expected behavior

Environment details

Additionally, please provide details regarding the Kubernetes Infrastructure, as shown below:

Additional Context

david-yu commented 2 years ago

Hi @Joxit we are aware that the connection limits are not configurable on ingress gateway's cluster config - max_connections, max_pending_requests, and max_requests are all at the default (1024). I'm going to transfer this to Core as we'd need to expose via a Config Entry field.

Amier3 commented 2 years ago

Hey @Joxit

Just an update that we didn't forget about this. This has come up a few times and we're currently tracking this in https://github.com/hashicorp/consul/issues/8722 . We use 👍 's as a way to try and gauge the popularity of a feature request, so I encourage you to thumbs up that issue.

Joxit commented 2 years ago

Hi, thanks for the update 😊