At the moment, I have a Docker container for a Flask application and a container for the mysql database.
I start the mysql database container with the name "db" and then I start the flask application using the following command-
docker run -d -p 80:80 --name acts1 --link db acts-app
acts-app is the name of the docker image.
I want to deploy my application containers on kubernetes and have them connect to a single database container "db". Here we use the --link
flag to achieve it, how do we do it on kubernetes?
In Kubernetes you create Service that points to Pods. For example, you create "mysql" service which points to "mysql" pod. Then you configure your application to go to hostname "mysql" with proper port and that's all. Very easy.
Read more here: https://kubernetes.io/docs/concepts/services-networking/service/