haproxy-ingress的部署

admin 2022年1月16日20:08:51评论153 views字数 1255阅读4分11秒阅读模式

以前给环境安装ingress都直接用kubernetes的ingress-nginx,国内没有安装源,而且ingress自己没有高可靠,最近研究了一种新的ingress,haproxy-ingress,效果不错,安装也方便,还默认支持高可靠,

参考https://haproxy-ingress.github.io/docs/getting-started/,

需要用helm来安装,因此先安装helm,

wget https://get.helm.sh/helm-v3.7.2-linux-amd64.tar.gz,

tar -zxvf helm-v3.7.2-linux-amd64.tar.gz,

sudo mv linux-amd64/helm /usr/local/bin/,

给helm添加haproxy-ingress的repo,

helm repo add haproxy-ingress https://haproxy-ingress.github.io/charts,

helm repo update,helm repo list,

需要先准备values文件,从这里下载模板,

https://github.com/haproxy-ingress/charts/blob/release-0.13/haproxy-ingress/values.yaml,

修改两个参数,vim haproxy-ingress-values.yaml,

hostNetwork: true,replicaCount: 2,

通过helm安装haproxy-ingress,

helm install haproxy-ingress haproxy-ingress/haproxy-ingress --create-namespace --namespace ingress-controller --version 0.13.5 -f haproxy-ingress-values.yaml,

创建一个ingress验证效果,

vim httpd-ingress.yaml,
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: ingress-nginx
  annotations:
    kubernetes.io/ingress.class: haproxy
  namespace: httpd
spec:
  rules:
  - host: nginx.test.com
    http:
      paths:
      - path:
        backend:
          serviceName: httpd-service
          servicePort: 80

由于ingress-nginx用的daemonset,每个node上都有ingress controller,

从外网直接访问任何node的80或443端口都能访问业务,这就是我要的高可靠效果。

原文始发于微信公众号(云计算和网络安全技术实践):haproxy-ingress的部署

  • 左青龙
  • 微信扫一扫
  • weinxin
  • 右白虎
  • 微信扫一扫
  • weinxin
admin
  • 本文由 发表于 2022年1月16日20:08:51
  • 转载请保留本文链接(CN-SEC中文网:感谢原作者辛苦付出):
                   haproxy-ingress的部署http://cn-sec.com/archives/739715.html

发表评论

匿名网友 填写信息