haproxy-kubernetes/README_GO.md
holzi1005 4c65ddfb9e
All checks were successful
Build Go Binary / build (push) Successful in 31s
Update README_GO.md
2025-06-29 07:42:26 +02:00

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