Example-voting-app deploying on kubernetes doesn't require linking pods?

Hi there,

In docker we did the sample-voting app deployed and accessed, there we link the docker containers to gather using --link option, whey are we not doing that step during the kubernetes example voting app deployment ?

is it ideal/production level to make all the 5 containers in the sample application as a single pod and deploy it on docker in cluster env? can we do that, if yes, there won’t ben any performance issues right?

Hello @karunakar.jeejula
The --link option in docker it’s not a mandatory option for connection between containers, it just adds some entries in /etc/hosts to facilitate the connections between containers but finally the containers communicate via IP address. And the same thing in Kubernetes also Kubernetes gives every pod its own cluster-private IP address, so you do not need to explicitly create links between pods or map container ports to host ports.

Generally, you can add multiple different containers in the same pod but, here in our example, we have two containers are the same kind(result and vote are listening on port 80) so there are issues that will happen.

Also note that the names of services are implemented in the code itself.

For the voting app web service is dependent on the redis service

When the webserver starts as you can see in this piece of code on the webserver it looks for a redis :

And for the worker app: As you can see in this source code of the application it makes an attempt to connect to a Postgres database on host db :

Finally, the worker application requires access to both the redis as well as the Postgres database.

Reference: https://github.com/dockersamples/example-voting-app/blob/master/worker/src/main/java/worker/Worker.java

Thanks,
KodeKloud Support