haproxy-ingress的部署
以前給環境安裝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端口都能訪問業務,這就是我要的高可靠效果。