<p>I have something like this:</p>

<pre><code>           POD-1
             |
 -------------------------
 ?|?        ?|?        ?|?
service-1 service-2 service-3
</code></pre>

<p>How do I communicate from a server inside a pod, to other servers in pods behind services?</p>

Liron Navon
<p>You need to have services for the pod that you want to access. You can just use internal endpoints of the corresponding services of the pod. </p>

<p>As example let's think there is a <code>mysql</code> pod and service corresponding to it as <code>mysql-svc</code> of type ClusterIP exposing port 3306 as below. </p>

<pre><code>apiVersion: v1
kind: Service
metadata:
  name: mysql-svc
spec:
  ports:
  - name: db-port
    protocol: "TCP"
    port: 3306
    targetPort: 3306
  selector:
    app: mysql
</code></pre>

<p>And there is a separate pod of python application which uses that mysql. yo can access that mysql server inside pod using <code>mysql://mysql-svc:3306/dbName</code> which is the internal endpoint of <code>mysql-svc</code></p>

<p>And if your pods are in two different namespaces (mysql in <code>dev</code> namespace and python app in <code>qa</code> namespace) you can use <code>mysql-svc.dev.svc.cluster.local</code> instead.</p>
