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