kubernetes-ingress icon indicating copy to clipboard operation
kubernetes-ingress copied to clipboard

Cannot run HAProxy Kubernetes Ingress Controller outside cluster

Open bnk120 opened this issue 3 years ago • 3 comments

Hi, According to this entry on blog: https://www.haproxy.com/blog/run-the-haproxy-kubernetes-ingress-controller-outside-of-your-kubernetes-cluster/ I'm trying to create own onpremise local lab. After many hours I encountered a problem with haproxy ingress controller.

haproxy-ingress.service - "HAProxy Kubernetes Ingress Controller" Loaded: loaded (/usr/lib/systemd/system/haproxy-ingress.service; enabled; vendor preset: disabled) Active: inactive (dead) since Sun 2022-08-21 18:33:06 EDT; 3s ago Docs: https://www.haproxy.com/ Process: 4796 ExecStart=/usr/local/bin/haproxy-ingress-controller --external --configmap=default/haproxy-kubernetes-ingress --program=/usr/sbin/haproxy --disable-ipv6 --ipv4-bind-address=0.0.0.0 --http-bind-port=80 & (code=exited, sta> Process: 4794 ExecStartPre=/usr/bin/wget https://raw.githubusercontent.com/haproxytech/kubernetes-ingress/master/fs/usr/local/etc/haproxy/haproxy.cfg -P /tmp/haproxy-ingress/etc/ (code=exited, status=0/SUCCESS) Process: 4792 ExecStartPre=/bin/mkdir -p /tmp/haproxy-ingress/etc/ (code=exited, status=0/SUCCESS) Main PID: 4796 (code=exited, status=0/SUCCESS) Aug 21 18:33:06 haproxy.local.com haproxy-ingress-controller[4796]: 2022/08/21 18:33:06 Controller sync period: 5s Aug 21 18:33:06 haproxy.local.com haproxy-ingress-controller[4796]: 2022/08/21 18:33:06 Running on haproxy.local.com Aug 21 18:33:06 haproxy.local.com haproxy-ingress-controller[4796]: 2022/08/21 18:33:06 k8s/main.go:86 Running on Kubernetes version: v1.24.4 linux/amd64 Aug 21 18:33:06 haproxy.local.com haproxy-ingress-controller[4796]: 2022/08/21 18:33:06 INFO builder.go:216 running default backend server on :6061 Aug 21 18:33:06 haproxy.local.com haproxy-ingress-controller[4796]: [ALERT] 232/183306 (4801) : parsing [/tmp/haproxy-ingress/etc/haproxy.cfg:14] : unknown keyword 'default-path' in 'global' section Aug 21 18:33:06 haproxy.local.com haproxy-ingress-controller[4796]: [ALERT] 232/183306 (4801) : parsing [/tmp/haproxy-ingress/etc/haproxy.cfg:41] : error detected in frontend 'stats' while parsing 'http-request use-service' rule : 'prom> Aug 21 18:33:06 haproxy.local.com haproxy-ingress-controller[4796]: [ALERT] 232/183306 (4801) : Error(s) found in configuration file : /tmp/haproxy-ingress/etc/haproxy.cfg Aug 21 18:33:06 haproxy.local.com haproxy-ingress-controller[4796]: 2022/08/21 18:33:06 PANIC builder.go:146 failed to initialize haproxy API client: dial unix /tmp/haproxy-ingress/run/haproxy-runtime-api.sock: connect: no such file o> Aug 21 18:33:06 haproxy.local.com haproxy-ingress-controller[4796]: Error : failed to initialize haproxy API client: dial unix /tmp/haproxy-ingress/run/haproxy-runtime-api.sock: connect: no such file or directory Aug 21 18:33:06 haproxy.local.com systemd[1]: haproxy-ingress.service: Succeeded.

I created haproxy-ingress.service according to this:

[Unit] Description="HAProxy Kubernetes Ingress Controller" Documentation=https://www.haproxy.com/ Requires=network-online.target After=network-online.target [Service] Type=simple User=root Group=root ExecStartPre=/bin/mkdir -p /tmp/haproxy-ingress/etc/ ExecStartPre=/usr/bin/wget https://raw.githubusercontent.com/haproxytech/kubernetes-ingress/master/fs/usr/local/etc/haproxy/haproxy.cfg -P /tmp/haproxy-ingress/etc/ ExecStart=/usr/local/bin/haproxy-ingress-controller --external --configmap=default/haproxy-kubernetes-ingress --program=/usr/sbin/haproxy --disable-ipv6 --ipv4-bind-address=0.0.0.0 --http-bind-port=80 & ExecReload=/bin/kill --signal HUP $MAINPID KillMode=process KillSignal=SIGTERM Restart=on-failure LimitNOFILE=65536 [Install] WantedBy=multi-user.target

The error is as follows: Error : failed to initialize haproxy API client: dial unix /tmp/haproxy-ingress/run/haproxy-runtime-api.sock: connect: no such file or directory

I don't know where is a problem...

bnk120 avatar Aug 21 '22 22:08 bnk120

Hi @bnk120 , Thanks for reporting. We will have a look as soon as possible.

ivanmatmati avatar Aug 22 '22 07:08 ivanmatmati

I'm also having the same error.

I'm trying to translate https://github.com/haproxytechblog/ingress-controller-external-example from the vagrant demo into an on-premise centos-based setup, without success.

kphunter avatar Sep 11 '22 15:09 kphunter

@kphunter I've resolved my problem using other linux distribution. In my case I had to switch to Ubuntu 22.04. I tried solve this problem on CentOS 8 and 9, Debian 10, but still got a poor result.

bnk120 avatar Sep 12 '22 17:09 bnk120

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Oct 12 '22 21:10 stale[bot]

Just providing some additional context as I also ran into this issue. It appears to be caused when the haproxy binary used is not compiled with the prometheus exporter addon enabled. This is the case with at least a few standard distro packages. I briefly tried specifying --prometheus false as an option but that didn't appear to work, the prometheus service related config was still present in the haproxy.cfg file. In the end I just resorted to compiling my own haproxy binary with the USE_PROMEX=1 flag enabled.

Brian-Cole avatar Oct 18 '22 17:10 Brian-Cole

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Nov 17 '22 19:11 stale[bot]