<p>First of all, I am sorry that the grammar may be incorrect because I used Google Translate.</p>
<p>1.Deploy pods and services in a Kubernetes environment.</p>
<pre><code>apiVersion: v1
kind: Pod
metadata:
  name: testml
  labels:
    app: testml-pod
spec:
  containers:
  - name: testmlserver
    image: test_ml_server:2.8
    ports:
      - containerPort: 8080
      - containerPort: 5100
    env:
      - name: POD_NAME
        valueFrom:
          fieldRef:
            fieldPath: metadata.name
    volumeMounts:
      - name: testserver-api
        mountPath: /app/test/api
      - name: testmlserver-csv
        mountPath: /app/test/csv

  - name: testmldb
    image: test_ml_db:1.4
    ports:
      - containerPort: 1433
    env:
      - name: POD_NAME
        valueFrom:
          fieldRef:
            fieldPath: metadata.name
    volumeMounts:
      - name: estmldb
        mountPath: /var/opt/mssql/data

  volumes:
  - name: testmlserver-api
    hostPath:
      path: /usr/testhostpath/testmlserver/api
  - name: testmlserver-csv
    hostPath:
      path: /usr/testmlhostpath/testserver/csv
  - name: testmldb
    hostPath:
      path: /usr/testmlhostpath/testmldb
</code></pre>
<p>After the server container is deployed, run the python server in the container.</p>
<pre><code>apiVersion: v1
kind: Service
metadata:
  name: testml-service
spec:
  type: NodePort
  ports:
  - name: testml-server-port
    port: 8080
    targetPort: 8080
    protocol: TCP
    nodePort: 30080
  - name: testml-python-port
    port: 5100
    targetPort: 5100
    protocol: TCP
    nodePort: 30051

  - name: testml-db-port
    port: 1433
    targetPort: 1433
    protocol: TCP
    nodePort: 30014
  selector:
    app: test-pod
</code></pre>
<p>In this way, both pods and services have been deployed.</p>
<p>Connect to the server(tomcat) container and run the python server file.
At this time, the address value used when calling the python server from the web is 'http://testml:5100'
I tried to write it and communicate with it.
However, Cross-Origin Read Blocking (CORB) has occurred
I tried also with'http://localhost:5100' because there is another way to communicate in one container, but Connetc refused.</p>
<p>In the docker-compose environment, I checked that the python server is called when communicating with localhost, but I do not know the cause of the error in the kubernets environment.</p>
<p>Checking various things As a result of checking the port in the server (tomcat) container, it is confirmed that 0.0.0.0 does not apply to only the python port.
<a href="https://i.stack.imgur.com/Tt0oj.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Tt0oj.png" alt="enter image description here" /></a></p>
<p><strong>How can I call the python server normally in the server container?</strong></p>
<ul>
<li><p>In web server(tomcat)   connect with the db container by pod name as shown below. POD NAME =&gt; testml</p>
<pre><code>&lt;property name=&quot;url&quot; value=&quot;jdbc:log4jdbc:sqlserver://testml:1433;database=test_ml;autoReconnect=true&quot; /&gt;
</code></pre>
</li>
<li><p>In the same way, I tried to connect the python server with pod name, but it fails.</p>
<p>&lt;api.host.server=http://testml:5100&gt;</p>
</li>
</ul>

IronJo
<p>I think you can't connect by <a href="https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/#pod-s-hostname-and-subdomain-fields" rel="nofollow noreferrer">pod's name</a> unless you have a <a href="https://kubernetes.io/docs/concepts/services-networking/service/#headless-services" rel="nofollow noreferrer">headless service</a> defined. You can connect via <code>Pod's</code> IP but that is not a recommended approach since the Pod's IP is dynamic and can change across updates.</p>
<p>However, as you have created a <code>Service</code> object as well, you can use that for communication using it's name as <code>http://testml-service:port</code>.</p>
<p>Further, as the <code>Service</code> object is of type <a href="https://kubernetes.io/docs/concepts/services-networking/service/#nodeport" rel="nofollow noreferrer"><code>NodePort</code></a>, you can also connect via the IP of the nodes of the cluster.</p>
