简体   繁体   English

如何在 Kubernetes 中配置 HAproxy Ingress controller

[英]How to configure HAproxy Ingress controller in Kubernetes

So we have a SQL server deployment with replica=2 in K8s which I need to make load balanced.所以我们在 K8s 中有一个 SQL 服务器部署,副本 = 2,我需要进行负载平衡。 I'm using Haproxy ingress controller to achieve this goal but I'm stuck in configuring Haproxy.我正在使用 Haproxy 入口 controller 来实现这个目标,但我一直在配置 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!我正在尝试基于此链接配置 Haproxy,但我不知道如何将我的两个 pod 呈现给入口!

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?问题是在“spec.rules.host”部分,我没有任何域,而是有两个 IP 属于我的 SQL pod? How am I supposed to represent my pods to the ingress?我应该如何向入口表示我的 pod? Am I doing right, I've looked it up alot, but no luck!我做得对吗,我查了很多,但没有运气!

PS: What is the best practice for Load Balancing SQL server? PS:负载均衡SQL服务器的最佳实践是什么?

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. DNS 系统将主机名转换为 IP。使用在 DNS 系统中注册的域,您可以在要访问的系统的/etc/hosts文件中添加主机名到 IP 的映射。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM