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

docs: How to achieve Backend failover? #4501

Closed
ferdinandosimonetti opened this issue Oct 23, 2024 · 1 comment · Fixed by #4637
Closed

docs: How to achieve Backend failover? #4501

ferdinandosimonetti opened this issue Oct 23, 2024 · 1 comment · Fixed by #4637
Assignees
Labels
documentation Improvements or additions to documentation
Milestone

Comments

@ferdinandosimonetti
Copy link

Description:
I'd like to implement failover in case of unhealty backend workload for an HTTPRoute.
Scenario:

  • two workloads (workload4 and workload2) with their respective Services (workload4 and workload2)
  • during normal operations, 100% of the requests coming in through the HTTPRoute should be routed to workload4
  • if workload4's Pods fail (or are not present) for whatever reason, then 100% of requests should be routed to workload2

I'm using v0.0.0-latest Helm Chart version and I've set config.envoyGateway.extensionApis.enableBackend=true

I tried this HTTPRoute

---
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
  name: tobackend
  namespace: default
spec:
  parentRefs:
    - name: test-fsmn-xyz
      sectionName: https
  hostnames:
    - "test0.fsmn.xyz"
  rules:
    - backendRefs:
        - group: gateway.envoyproxy.io
          kind: Backend
          name: workload4
        - group: gateway.envoyproxy.io
          kind: Backend
          name: workload2
      matches:
        - path:
            type: PathPrefix
            value: /tobackend

And these Backends

---
apiVersion: gateway.envoyproxy.io/v1alpha1
kind: Backend
metadata:
  name: workload4
  namespace: default
spec:
  endpoints:
    - fqdn:
        hostname: workload4.default.svc.cluster.local
        port: 80
---
apiVersion: gateway.envoyproxy.io/v1alpha1
kind: Backend
metadata:
  name: workload2
  namespace: default
spec:
  fallback: True
  endpoints:
    - fqdn:
        hostname: workload2.default.svc.cluster.local
        port: 3000

But, as if I set workload4's Pods to fail, I keep getting 503 status replies, instead of failing over to workload2's Pods
I guess I'm missing something important, here.
Thanks in advance!

Relevant Links:
Enable Backend

@guydc
Copy link
Contributor

guydc commented Oct 23, 2024

You should also let envoy know how to determine that a certain backend is unhealthy for the failover to kick-in. You can achieve this using either Active or Passive healthchecks in BackendTrafficPolicy applied to the tobackend route:

@arkodg arkodg added documentation Improvements or additions to documentation and removed triage labels Oct 23, 2024
@arkodg arkodg self-assigned this Oct 23, 2024
@arkodg arkodg added this to the v1.2.0 milestone Oct 23, 2024
@arkodg arkodg changed the title How to achieve Backend failover? docs: How to achieve Backend failover? Oct 23, 2024
arkodg added a commit to arkodg/gateway that referenced this issue Nov 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants