HAProxy 1.8 - Passing socket connection during HAProxy soft reload

10/27/2017

I am using kubernetes load-lanacer(Here the haproxy configuration is written in every 10s and restarted). Since I want to pass the socket connection while reloading the HAProxy, I changed the Dockerfile of the HAProxy such that it uses HAProxy 1.8-dev2 version. The image used is haproxytech/haproxy-ubuntu:1.8-dev2. Also I added the following line under the global section of the template.cfg file(This is the template in which the HAProxy configuration is written)

stats socket /var/run/haproxy/admin.sock mode 660 level admin expose-fd listeners

Also I changed the reload command in haproxy_reload file as follows

haproxy -f /etc/haproxy/haproxy.cfg -p /var/run/haproxy.pid -x /var/run/haproxy/admin.sock -sf $(cat /var/run/haproxy.pid)

Once I run the docker image I get the following error.(kubectl create -f rc.yaml --namespace load-balancer)

W1027 07:13:37.922565 5 service_loadbalancer.go:687] Requeuing kube-system/kube-dns because of error: error restarting haproxy -- [WARNING] 299/071337 (21) : We didn't get the expected number of sockets (expecting 1347703880 got 0)

[ALERT] 299/071337 (21) : Failed to get the sockets from the old process! : exit status 1

FYI: I commented the stats socket line in the template.cfg file and ran the docker image to verify whether the restart command identifies the socket. The same error occurred. Seems like the soft restart command doesn't identify the stats socket created by the HAProxy.

-- Saarrah Isthikar
docker
dockerfile
haproxy
kubernetes
sockets

0 Answers