Jul 19 2021
How to Access ProxySQL Web Interface on Kubernetes
I wrote in a previous post about a ProxySQL Helm chart for Kubernetes, in which you can configure the pod from SQL queries. The chart includes an ingress to reach the stats server on port 6080. Here are a few steps to get this working.
Ingress needs to be activated in the Helm Values file and ProxySQL web server also requires the admin-web_enabled admin variable to be set.
ingress:
enabled: true
annotations:
kubernetes.io/ingress.class: nginx
hosts:
- host: proxy.domain.lan
paths:
- /
sqlqueries: |
SET admin-web_enabled='true';
LOAD ADMIN VARIABLES TO RUNTIME;
-- other SQL queries
If you leave it like this, HTTP connections to the web interface will throw the following error:
Error: received handshake message out of context
ProxySQL web interface accepts HTTPS connections only – even though examples in the documentation use HTTP – and there’s no workaround it.
Ingress has to connect to the backend using the HTTPS protocol. Nginx lets you specify the protocol used with the backend-protocol annotation. You still have the choice to leave ingress access from outside in HTTP, but don’t on a public interface.
nginx.ingress.kubernetes.io/backend-protocol: "HTTPS"