Haproxy node port keep changing

I follow this guide to install Percona Operator on microk8s single node machine
All is well I am able to access the database from inside the cluster
trying to change the service type of the haproxy to NodePort seems to work (I want to access the database outside the cluster for testing reasons)
The issue is that the port keeps changing all the time
This is some lines when I am running this command
sudo microk8s.kubectl get services -w

cluster1-haproxy                  NodePort    10.152.183.46   <none>        3306:31742/TCP,3309:31594/TCP,33062:31712/TCP   4m1s
cluster1-haproxy                  NodePort    10.152.183.46   <none>        3306:32463/TCP,3309:32154/TCP,33062:31608/TCP   4m6s
cluster1-haproxy                  NodePort    10.152.183.46   <none>        3306:31969/TCP,3309:32474/TCP,33062:32525/TCP   4m11s
cluster1-haproxy                  NodePort    10.152.183.46   <none>        3306:30297/TCP,3309:30830/TCP,33062:32413/TCP   4m17s
cluster1-haproxy                  NodePort    10.152.183.46   <none>        3306:30178/TCP,3309:31152/TCP,33062:30276/TCP   4m22s

this is my haproxy config section in the cr.yaml

  haproxy:
     enabled: true
     size: 1
     image: percona/percona-xtradb-cluster-operator:1.7.0-haproxy
     serviceType: NodePort
1 Like

Hello @Nehemia ,

thank you for raising this. We are aware of this issue and it will be fixed in the next release.
Please see this issue in JIRA: [K8SPXC-609] Frequent HAProxy service updates causing issues with load balancers - Percona JIRA

As a workaround please use Loadbalancer or ClusterIP instead.

2 Likes