I have HAproxy in front of my K8s cluster. It works perfectly by IP address and port number.

frontend kubernetes-test-frontend
    mode tcp
    option tcplog
    default_backend kubernetes-test-backend

backend kubernetes-test-backend
    mode tcp
    option tcp-check
    balance roundrobin
    server k8master1 check
    server k8master2 check
    server k8node1 check
    server k8node2 check
    server k8node3 check

Can I have FQDN to replace IP and port number? For example, if I have www.test.com mapping to in my internal DNS. Can I set up HAproxy to map www.test.com/test to node's IP:30030?

  • 1
    You can’t have FQDN map to IP address and port number.  You should be able to have FQDN map to IP address; but FQDN doesn’t map to port number.  Have you tried www.test.com:30030? … … … … … … … … … … … … … … … … … P.S.  Your config file excerpt uses port number 30030, but your question mentions port number 30090. Jun 7, 2021 at 1:12
  • 1
    Doesn't haproxy have an other mode than TCP? Jun 7, 2021 at 4:19
  • @Scott Sorry for the typo:)
    – ITnewbie
    Jun 7, 2021 at 4:27
  • 1
    @Gerard H. Pille, HAProxy can work in http mode or in tcp mode, and HAProxy can use DNS to lookup server names, but you still need to define the listening port. haproxy.com/documentation/hapee/latest/configuration/…
    – Mikael H
    Jun 7, 2021 at 5:39

1 Answer 1


You can switch from using an IP address to using DNS - but read the documentation for your version of HAProxy to understand the potential trade-offs.

If you switch to DNS lookups for your backend servers you will still need to define their listening port in your backend configuration.

  • Thank you so much! Just like you mentioned, I solved the problem by using http mode and ACL in the HAProxy configuration
    – ITnewbie
    Jul 21, 2021 at 11:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.