简体   繁体   中英

how to access mySQL server in kubernetes

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.

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.

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?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM