How can I access MariaDb outside from Helm installation

2/6/2022

I have a RKE2 kube installation, 3 nodes, I install MariaDB from BitNami repository:

- name: mariadb
  repository: https://charts.bitnami.com/bitnami
  version: 10.3.2

It boots up correctly in my kube installation, but I need to access it from outside the cluster, let's say with my Navicat client as example.

This is my values.yaml:

mariadb:
  clusterDomain: a4b-kube.local
  auth:
    rootPassword: "password"
    replicationPassword: "password"
  architecture: replication
  primary:
    service:
      type: LoadBalancer
      loadBalancerIP: mariadb.acme.com
  secondary:
    replicaCount: 2

Listing the services I see:

NAME                         TYPE           CLUSTER-IP     EXTERNAL-IP   PORT(S)          AGE
a4b-test-mariadb-primary     LoadBalancer   10.43.171.45   <pending>     3306:31379/TCP   48m

And the external IP never gets updated, I also try specifing an IP instead of dns, in my case was 192.168.113.120 but I got same result. What am I missing?

-- NiBE
helmfile
kubernetes
kubernetes-helm
mariadb
rke

2 Answers

2/7/2022

You might consider using NodePort

mariadb:
  clusterDomain: a4b-kube.local
  auth:
    rootPassword: "password"
    replicationPassword: "password"
  architecture: replication
  primary:
    service:
      type: NodePort
      nodePort: 32036
  secondary:
    replicaCount: 2

nodePort: 32036 you can choose in range 30000 - 32767 (default)
Then, you can access via nodeIP:nodePort

-- quoc9x
Source: StackOverflow

2/7/2022

You need an ingress controller to setup the EXTERNAL-IP. But if you have no intention to expose the database to the Internet; and the cluster nodes are network reachable to your client application, you can use NodePort instead of LoadBalancer. You can then connect to your database thru any of the 3 nodes with the node port from the outside of your cluster.

-- gohm&#39;c
Source: StackOverflow