diff --git a/base/haproxy/haproxy-configmap.yaml b/base/haproxy/haproxy-configmap.yaml new file mode 100644 index 0000000..07a8995 --- /dev/null +++ b/base/haproxy/haproxy-configmap.yaml @@ -0,0 +1,42 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: haproxy-config +data: + haproxy.cfg: | + global + log /dev/log local0 + log /dev/log local1 notice + daemon + + defaults + mode http + balance roundrobin + timeout client 10s + timeout server 10s + timeout connect 10s + + frontend fe_8188 + mode http + bind *:8188 + default_backend be_8188 + + frontend stats + mode http + bind *:8280 + stats enable + stats refresh 10s + stats uri /stats + stats show-modules + + backend be_8188 + mode http + option httpchk GET /api/hq/sinahealth + http-check expect status 200 + balance roundrobin + server s1 119.29.148.232:8188 check + server s2 43.139.100.109:8188 check + server s3 43.136.103.146:8188 check + server s4 119.29.79.240:8188 check + server s5 129.204.226.60:8188 check + server s6 119.91.60.129:8188 check diff --git a/base/haproxy/haproxy-service.yaml b/base/haproxy/haproxy-service.yaml new file mode 100644 index 0000000..74afad9 --- /dev/null +++ b/base/haproxy/haproxy-service.yaml @@ -0,0 +1,13 @@ +apiVersion: v1 +kind: Service +metadata: + name: haproxy-service +spec: + ports: + - port: 8188 + name: haproxy + - port: 8280 + name: stats + clusterIP: None + selector: + app: haproxy \ No newline at end of file diff --git a/base/haproxy/haproxy-statefulset.yaml b/base/haproxy/haproxy-statefulset.yaml new file mode 100644 index 0000000..a20c06a --- /dev/null +++ b/base/haproxy/haproxy-statefulset.yaml @@ -0,0 +1,30 @@ +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: haproxy +spec: + serviceName: "haproxy" + replicas: 1 + selector: + matchLabels: + app: haproxy + template: + metadata: + labels: + app: haproxy + spec: + containers: + - name: haproxy + image: haproxy:3.1.8-alpine + ports: + - containerPort: 8188 + - containerPort: 8280 # 监控端口 + volumeMounts: + - name: haproxy-config + mountPath: /usr/local/etc/haproxy/haproxy.cfg + subPath: haproxy.cfg + readOnly: true + volumes: + - name: haproxy-config + configMap: + name: haproxy-config \ No newline at end of file diff --git a/base/haproxy/kustomization.yaml b/base/haproxy/kustomization.yaml new file mode 100644 index 0000000..dcaffc2 --- /dev/null +++ b/base/haproxy/kustomization.yaml @@ -0,0 +1,4 @@ +resources: + - haproxy-configmap.yaml + - haproxy-statefulset.yaml + - haproxy-service.yaml \ No newline at end of file diff --git a/gp2504/kustomization.yaml b/gp2504/kustomization.yaml index b8cb6c2..78ebd69 100644 --- a/gp2504/kustomization.yaml +++ b/gp2504/kustomization.yaml @@ -16,8 +16,9 @@ resources: - ../base/redis-nodeport - ../base/tls - ../base/basic-auth + - ../base/haproxy - ingress.yaml - + configMapGenerator: - name: mysql-configmap envs: