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.

3
  • its asking for a password @hansika Jan 11, 2019 at 6:08
  • give your mysql root password. Did you specify any password when you deploy mysql? Jan 11, 2019 at 7:01
  • mysql -u {username} -p -h {any kubernetes worker ip} -P {nodePort} worked for me :) Jan 11, 2019 at 8:34
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?

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.