2

I have created a MySQL deployment in kubernetes and exposed it as nodes-port.

What I can do:
Access it from inside the cluster using
kubectl run -it --rm --image=mysql:5.6 --restart=Never mysql-client -- mysql -h mysql -ppassword

What I want to do:
Access the MySQL server from outside the cluster(like accessing a normal MySQL server).
Kubernetes v1.13 in DigitalOcean Cloud.
Guide me, please.

2 Answers 2

3

You can access it by mysql -u {username} -p {password} -h {any kubernetes worker ip} -P {nodePort}. After you start mysql container and expose it ad node port through a service.

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

3 Comments

its asking for a password @hansika
give your mysql root password. Did you specify any password when you deploy mysql?
mysql -u {username} -p -h {any kubernetes worker ip} -P {nodePort} worked for me :)
0

You need to specify the MYSQL_ROOT_PASSWORD while bringing up the pod. How were you able to bring it up in Docker without it?

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.