initial checkin

This commit is contained in:
Radar231 2021-10-14 10:33:47 -04:00
commit 8d872a100f
3 changed files with 84 additions and 0 deletions

26
README.md Normal file
View File

@ -0,0 +1,26 @@
# haproxy docker deployment
## Introduction
This is a docker-compose configuration to deploy an haproxy container.
This haproxy instance is set up to be a Kubernetes API load-balancer for the homelab k8s cluster.
## Links
* https://hub.docker.com/_/haproxy
* https://hub.docker.com/r/haproxytech/haproxy-alpine
* https://cbonte.github.io/haproxy-dconv/
* https://www.haproxy.com/blog/how-to-run-haproxy-with-docker/
* https://www.ibm.com/docs/en/api-connect/2018.x?topic=environment-load-balancer-configuration-in-kubernetes-deployment
* https://docs.kublr.com/articles/onprem-multimaster/
## Directories
<pre>
docker_haproxy/
├── config/
│   └── haproxy.cfg
└── docker-compose.yml
</pre>

38
config/haproxy.cfg Normal file
View File

@ -0,0 +1,38 @@
global
stats socket /var/run/api.sock user haproxy group haproxy mode 660 level admin expose-fd listeners
log stdout format raw local0 info
defaults
log global
mode http
option httplog
option dontlognull
timeout client 10s
timeout connect 5s
timeout server 10s
timeout http-request 10s
frontend stats
bind *:8404
stats enable
stats uri /
stats refresh 10s
frontend k8s-api
bind *:6443
bind 127.0.0.1:6443
mode tcp
option tcplog
option forwardfor
default_backend k8s-api
backend k8s-api
mode tcp
option tcplog
option ssl-hello-chk
option log-health-checks
default-server inter 10s fall 2
server node-1-rpi4 192.168.7.51:6443 check
server node-2-lxc 192.168.7.52:6443 check
server node-3-lxc 192.168.7.53:6443 check

20
docker-compose.yml Normal file
View File

@ -0,0 +1,20 @@
---
version: '3'
services:
haproxy:
container_name: haproxy
image: haproxytech/haproxy-alpine:2.4.7
volumes:
- ./config:/usr/local/etc/haproxy:ro
environment:
- PUID=1000
- PGID=1000
- TZ=America/Toronto
restart: unless-stopped
ports:
- "6443:6443"
- "8404:8404"
# EOF