voyagermesh/voyager

backup connection in backend

plachkov opened this issue · 0 comments

 kind: "Service"
 apiVersion: "v1"
 metadata:
   name: "external-mysql-service"
   annotations:
     ingress.appscode.com/check: "true"
 spec:
   ports:
     -  name: "mysql"
       protocol: "TCP"
       port: 3306
       targetPort: 3306
       nodePort: 0
---
 kind: "Endpoints"
 apiVersion: "v1"
 metadata:
   name: "external-mysql-service"
 subsets:
   - addresses:
       - ip: "10.0.0.1"         
     ports:
       - port: 11336        
         name: "mysql1"
   - addresses:
       - ip: "10.100.12.7"
     ports:
       - port: 3306
         name: "mysql2"
Ingress:
apiVersion: voyager.appscode.com/v1beta1
kind: Ingress
metadata:
  name: mysql-ingress
  annotations:
    ingress.appscode.com/type: Internal
spec:
  frontendRules:
  - port: 3306
  rules:
  - host: tcp.bar.com
    tcp:
      port: '3306'
      backend:
        serviceName: external-mysql-service
        servicePort: '3306'

How do I add let's say 10.100.12.7 as a backup server.
https://cbonte.github.io/haproxy-dconv/1.8/configuration.html#5.2-backup

This is a common use case, as the two sql servers are in different DCs. I would like to use the closest one and just in case of failure to failover to the second one(backup) connection. In the meanwhile I don't want to send any traffic to the backup connection as it will slow down my app. This is quite common scenario in kubernetes as normally connection to DBs are "external" in sense of kubernetes ecosystems and we need a way to failover.