0

I have deployed MySQL in my Kubernetes cluster. It works fine. But I am not aware of how to access or connect the MySQL service to other applications. I found that MySQL deployment is not browser-supported. When I call the MySQL server on the browser using IP:nodeport, I found the following error:

J��� 5.7.37����!bo.;�ÿÿ�ÿÁ����������rBPvNbCJ�mysql_native_password�!��ÿ„#08S01Got packets out of order 

I can access the MySQL server through Kubernetes dashboard's pod shell using the MySQL user and password.

2
  • If you want to use it through a browser then install some software that allows you to do so. Databases aren’t web servers or applications Commented Mar 23, 2022 at 5:22
  • @ashique Please improve your question. It's not clear which connection you mean, since from the title "how can i access" and then in the question "how to access or connect MySQL service to other applications". So, what is the real purpose? Commented Mar 23, 2022 at 16:04

1 Answer 1

1

You can try deploying the MySQL client on Kubernetes and connect using it.

MySQL client like : Adminer, phpMyadmin etc

Adminer example :

apiVersion: apps/v1 kind: Deployment metadata: name: adminer labels: app: adminer spec: selector: matchLabels: app: adminer template: metadata: labels: app: adminer spec: containers: - name: adminer image: adminer:4.6.3 ports: - containerPort: 8080 env: - name: ADMINER_DESIGN value: "pappu687" --- apiVersion: v1 kind: Service metadata: name: adminer-svc spec: selector: app: adminer ports: - protocol: TCP port: 8080 targetPort: 8080 

You can expose this deployment with service type Nodeport or Port forwarding.

kubectl port-forward svc/adminer-svc 8080:8080 

Open the localhost:8080

Once the service is exposed you can access the UI in the browser and from there you can access the MySQL database over the service name.

Read more about adminer : https://www.adminer.org/

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.