Install HAProxy 2.4 on CentOS7 and setup HAProxy in External Mode - ComputeCanada/ahep_interactive_analysis_facility GitHub Wiki
Instruction from https://serverfault.com/questions/1002144/install-haproxy-2-on-centos-7
Steps
Choose the haproxy branch
The 1st step defines the branch you are going to install, If you want latest of 2.0 just modify the URL to the branch you want, you'll have to repeat that change in every step you see an URL:
LATEST_HAPROXY=$(wget -qO- http://www.haproxy.org/download/2.4/src/ | egrep -o "haproxy-2\.[0-9]+\.[0-9]+" | head -1)
Download and install the package:
cd /usr/src/
wget http://www.haproxy.org/download/2.4/src/${LATEST_HAPROXY}.tar.gz
tar xzvf ${LATEST_HAPROXY}.tar.gz
yum install gcc-c++ openssl-devel pcre-static pcre-devel systemd-devel -y
cd /usr/src/${LATEST_HAPROXY}
make TARGET=linux-glibc USE_PCRE=1 USE_OPENSSL=1 USE_ZLIB=1 USE_CRYPT_H=1 USE_LIBCRYPT=1 USE_SYSTEMD=1 USE_PROMEX=1
mkdir /etc/haproxy
make install
Create a systemd service /usr/lib/systemd/system/haproxy.service
cat > /usr/lib/systemd/system/haproxy.service << 'EOL'
[Unit]
Description=HAProxy Load Balancer
After=syslog.target network.target
[Service]
Environment="CONFIG=/etc/haproxy/haproxy.cfg" "PIDFILE=/run/haproxy.pid"
ExecStartPre=/usr/local/sbin/haproxy -f $CONFIG -c -q
ExecStart=/usr/local/sbin/haproxy -Ws -f $CONFIG -p $PIDFILE
ExecReload=/usr/local/sbin/haproxy -f $CONFIG -c -q
ExecReload=/bin/kill -USR2 $MAINPID
KillMode=mixed
Restart=always
SuccessExitStatus=143
Type=notify
[Install]
WantedBy=multi-user.target
EOL
Create /etc/haproxy/haproxy.cfg
cat > /etc/haproxy/haproxy.cfg << 'EOL'
global
log /dev/log local0
log /dev/log local1 notice
daemon
defaults
log global
option dontlognull
timeout connect 50000
timeout client 50000
timeout server 50000
listen ListenName
bind *:80
mode tcp
server YourServer 127.0.0.1:80
EOL
Restart HAProxy and verify bash
systemctl start haproxy
systemctl status haproxy
Install BIRD Daemon
Set up HAProxy in External Mode
In general, the instruction is at https://www.haproxy.com/documentation/kubernetes/latest/installation/community/external-mode/.
However, since we've already install calico using Kubespray, we don't need to follow every step. The steps to use are
Install Kubernetes
- Copy admin.conf to the server, remember to change server address to the actual master node address
- Create a file named calico-bgp.yaml, remember the asNumber
- Just follow instruction
- Just follow instruction