ProxySQL service annotations not getting applied to proxysql service using operator

I am trying to configure the ProxySQL service in Kubernetes in Google cloud to setup a a load balancer with an Internal IP address. However, in order for Google to use an internal IP, I need to add an annotation to the ProxySQL service.

I tried modifying cr.yaml with the following:

  proxysql:
    enabled: true
    size: 3
    image: percona/percona-xtradb-cluster-operator:1.7.0-proxysql
    imagePullPolicy: Always
  ...
    annotations:
      cloud.google.com/load-balancer-type: Internal
    loadBalancerSourceRanges:
      - 10.0.0.0/8

I applied the configuration using:

bash$ kubectl -f cr.yaml

And verify with the command:

bash$ kubectl describe service cluster1-proxysql

And I don’t see the annotation:

Name:                     cluster1-proxysql
Namespace:                default
Labels:                   app.kubernetes.io/instance=cluster1
                      app.kubernetes.io/name=percona-xtradb-cluster
Selector:            app.kubernetes.io/component=proxysql,app.kubernetes.io/instance=cluster1,app.kubernetes.io/name=percona-xtradb-cluster

I can only see the annotation after editing the service manually.

Name:                     cluster1-proxysql
Namespace:                rldb-replica
Labels:                   app.kubernetes.io/instance=cluster1
                      app.kubernetes.io/name=percona-xtradb-cluster
Annotations:              cloud.google.com/load-balancer-type: Internal
Selector:                 app.kubernetes.io/component=proxysql,app.kubernetes.io/instance=cluster1,app.kubernetes.io/name=percona-xtradb-cluster

The parameter loadBalancerSourceRanges did not get applied either.

I tried searching the forum and the bug list but did not find anything related to this. Has anybody encountered this issue or know if this is a bug?

I also tried to use serviceAnnotations but got the same result.

I also saw this commit to fix the annotation for the pods but did not find one for the service. Is it possible that this also needs to be fixed in the service deployments?

In addition to the above, is there a way to set a static IP address by setting the loadBalancerIP so that the IP will not change if I modify the service? I did not find it in the documentation.

1 Like

Hello @lreyes ,

thank you for submitting this.

The flag you are looking for is serviceAnnotations. It will work if you create the cluster from scratch and have this annotation in the cr.yaml.

But unfortunately we have a bug, which is described here: [K8SPXC-614] serviceAnnotations is not applied on cr.yaml change - Percona JIRA

This bug is exactly about not being able to change the annotation for the Service object on Kubernetes through cr.yaml for already running cluster. It will be fixed in the next Operator release.

1 Like

Thank for the information @Sergey_Pronin .

Can you also confirm if it’s the same case with setting the loadBalancerSourceRanges and loadBalancerIP?

2 Likes

Yes, @lreyes, I can confirm. It also affects both loadBalancerSourceRanges and loadBalancerIP.
Both parametrs can be set on the start of the cluster, but you can’t change or add them after the cluster is up and running.

I have updated the case in JIRA with this info. Thank you for catching it.

1 Like