569 B
569 B
Start Go Script to create new Config
export KUBERNETES_HOST="https://10.0.20.7:6443"
export KUBERNETES_TOKEN="eyJhbGciOi..."
export KUBERNETES_VERIFYSSL="false"
export HAPROXY_TEMPLATE="./haproxy.tmpl"
./haproxy-generator > /etc/haproxy/haproxy.cfg && sudo systemctl restart haproxy
HaProxy Template
{{- range .backends }}
backend {{ .Name }}
mode tcp
balance leastconn
cookie {{ .Name }} insert indirect nocache
{{- range .Servers }}
server {{ .Name }} {{ .Address }}:{{ .Port }} check cookie {{ .Cookie }}
{{- end }}
{{- end }}