Access through LoadBalancer

If you are in an environment with a LoadBalancer, such as on Alibaba Cloud, it is recommended to use the cloud platform's LoadBalancer feature. When creating the PolarDB-X cluster, specify .spec.serviceType as LoadBalancer, and the operator will automatically create a service (Service) of type LoadBalancer. When supported by the cloud platform, Kubernetes will automatically configure the service as shown below:

NAME                 TYPE           CLUSTER-IP       EXTERNAL-IP   PORT(S)                         AGE
xxxxxxxxx            LoadBalancer   3306:30612/TCP,8081:30370/TCP   28h

At this point, you can use the IP shown under EXTERNAL-IP for access:

mysql -h8.209.29.16 -P3306 -upolardbx_root -p

Access through the Public Internet IP of the Machine

If you have enabled public internet IP addresses for some machines in your K8s cluster, you can use the port-forward method to map the access port of the instance to a machine with a public IP.

On a machine with a public IP, execute the following command to forward ports:

kubectl port-forward svc/{PolarDB-X cluster name} 3306 --address=

Note: You need to add --address= to allow access from external IPs.

Configure the corresponding security group or firewall of the machine to allow the 3306 port to be accessed by external machines. Afterward, you can access it using the machine's public IP + port 3306.

results matching ""

    No results matching ""