Expose HAProxy stats on Openshift 3.10
While testing out some kubernetes platforms (i.e Tectonic, Rancher 2.0 and Openshift) in my homelab I wanted to take a look at some good ol' statistics for the HAProxy based router in Openshift.
This is how I did.
Login.
oc login -u system:admin -n default
Then set and unset some environment variables.
oc env dc/router STATS_USERNAME=admin STATS_PASSWORD=password ROUTER_METRICS_TYPE- ROUTER_LISTEN_ADDR- -n default
Verify with your newly set credentials.
curl -u admin:password localhost:1936
Alright, so far so good. I'm using CentOS 7 as OS and Openshift installed by using these Ansible playbooks. I believe that the installer disables firewalld and only utilizes iptables as firewall.
To allow traffic to port 1936 I had to put the following line into /etc/sysconfig/iptables
on my master server.
-A INPUT -p tcp -m state --state NEW -m tcp --dport 1936 -j ACCEPT
I added the line beneath the line to allow traffic to port 22.
Reload iptables to make it read the new config.
systemctl restart iptables.service
Pic or it didn't happen
References:
https://docs.openshift.com/container-platform/3.10/admin_guide/iptables.html