This commit is contained in:
william 2025-06-07 22:46:04 +08:00
parent e6e093b7a1
commit 31bec3511e
5 changed files with 91 additions and 1 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -0,0 +1,4 @@
resources:
- haproxy-configmap.yaml
- haproxy-statefulset.yaml
- haproxy-service.yaml

View File

@ -16,6 +16,7 @@ resources:
- ../base/redis-nodeport - ../base/redis-nodeport
- ../base/tls - ../base/tls
- ../base/basic-auth - ../base/basic-auth
- ../base/haproxy
- ingress.yaml - ingress.yaml
configMapGenerator: configMapGenerator: