I am trying to implement failover https://www.haproxy.com/blog/failover-and-worst-case-management-with-haproxy/ using HA proxy. My current environment is on Azure. I have deployed two application and an ingress controller and ingress. where I am able to navigate the traffic based on the route mentioned in the ingress and setup works fine as it is. now, I wanted to achieve, say I am navigating to sample.url and the url is down I want the request to be routed to anothersample.url. I can see from the example that was set up in the instance installation of HAProxy. how would I achieve something similar in kubernetes. Here is my ingress class.
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: echo-ingress
annotations:
haproxy.org/path-rewrite: "/"
kubernetes.io/ingress.class: haproxy
spec:
rules:
- http:
paths:
- path: /helloworld-one
pathType: Prefix
backend:
service:
name: helloworld-one
port:
number: 8080
- path: /helloworld-two
pathType: Prefix
backend:
service:
name: hellowworld-two
port:
number: 8000
How to add backend snippet to block the IP or should it be in the ingress
backend-config-snippet: |
http-send-name-header x-dst-server
stick-table type string len 32 size 100k expire 30m
stick on req.cook(sessionid)