Search code examples
mysqlimagedockerkuberneteskubectl

Inter-Service communication between Kubernetes for mysql and tomcat


I have two services running on kubernetes using kubectl. 1. Tomcat 2. MYSQL

Scenario - Tomcat is external world facing. Hosted tomcat using node port. And MySQL service is backend and hence hosted it using cluster IP (default type).

Tomcat is not able to connect to MySQL. War file which I am using, need JDBC URL for connection.

I am able to connect to MySQL from my instance(master node). but tomcat service is not able to do.

enter image description here


Solution

  • We can do this by providing the service name directly. Here, For MySQL service I can provide MySQL-middleware-service2(NAme of my MySQL service)