How to configure HAproxy Ingress controller in Kubernetes

4/15/2020

So we have a SQL server deployment with replica=2 in K8s which I need to make load balanced. I'm using Haproxy ingress controller to achieve this goal but I'm stuck in configuring Haproxy. I'm trying to configure the Haproxy based on this link and I don't know how to present my two pods to the ingress!

There is this part of the link says:

---
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
  name: web-ingress
  namespace: default
spec:
  rules:
  - host: foo.bar
    http:
      paths:
      - path: /
        backend:
          serviceName: app
          servicePort: 80

The issue is that in "spec.rules.host" section, I don't have any domain rather I have two IPs belong to my SQL pods! How am I supposed to represent my pods to the ingress? Am I doing right? I've looked it up alot, but no luck!

P.S: What is the best practice for Load Balancing SQL server?

-- Mohammad K.
haproxy
haproxy-ingress
kubernetes
kubernetes-ingress
sql-server-2019

1 Answer

4/15/2020

A DNS system translates hostname to IPs.With a domain registered with DNS system you can add a mapping of hostname to IP in the /etc/hosts file of the system from where you want to access the hostname.

-- Arghya Sadhu
Source: StackOverflow