how to access mySQL server in kubernetes

39
January 12, 2019, at 03:50 AM

I have created a MySQL deployment in kubernetes and exposed it as nodes-port. I can access it from inside the cluster using kubectl run -it --rm --image=mysql:5.6 --restart=Never mysql-client -- mysql -h mysql -ppassword but I need to access the MySQL server from outside the cluster(like accessing a normal MySQL server). Guide me, please. I'm using Kubernetes v1.13 in Digital Ocean Cloud.

Answer 1

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.

READ ALSO
Indexing a MySQL table containing LONGTEXT field into Elastic Search

Indexing a MySQL table containing LONGTEXT field into Elastic Search

The table contains a LONGTEXT field that has special characters including quotes and commas

27
how to set collation_server and character_set_ server from utf8 to utf8mb4 and utf8mb4_unicode_ci?

how to set collation_server and character_set_ server from utf8 to utf8mb4 and utf8mb4_unicode_ci?

I have tried following this website https://mathiasbynensbe/notes/mysql-utf8mb4#utf8-to-utf8mb4, but i can't able to find collation_server which is in my

29
How to concat_ws primarykey(id) and date in a new column on same table?(MySQL)

How to concat_ws primarykey(id) and date in a new column on same table?(MySQL)

I need add a new column named date_id by using concat_ws('-', curdate,id) on a same table, the id is a primarykey and auto_incrementHow to do this?

18