MySQL with Docker/Kubernetes

8/16/2018

I am trying to deploy a MySQL Docker Image to Kubernetes. I mostly managed all tasks, Docker Image up and running in Docker, one final thing is missing from Kubernetes deployment.

MySQL has one configuration which is stating which user can log on from which Host 'MYSQL_ROOT_HOST' to configure that for Docker is no problem, Docker Networking is using '172.17.0.1' for bridging.

The problem with Kubernetes, this must be the IP of the Pod trying to connect MySQL Pod and every time a Pod starts, this IP changes.

I try to put the Label of the Pod connecting to the MySQL Pod but it is still looking the IP of the Pod instead of DNS name.

Do you have an idea how I can overcome this problem, I can't even figure out how this should work if I set AutoScaling for the Pod that is trying to connect MySQL, replicas will all have a different IP.

Thx for answers....

-- posthumecaver
docker
kubernetes
mysql

1 Answer

8/17/2018

As @RyanDowson and @siloko mentioned, you should use Service, Ingress or Helm Charts for these purposes.

Additional information you can find on Service, Ingress and Helm Charts pages.

-- Akar
Source: StackOverflow