<p>I have two microservices that communicate through http protocol. </p>

<ul>
<li><p>AC6K: C# microservice that gets data from an Atlas Copco 6000 device.</p></li>
<li><p>LocalWriter: python aplication that gets data from AC6K and stores the info in a data base</p></li>
</ul>

<p>I have tested it in Windows and Linux environments and it works fine. When I contenerize each microservice and make the deployment, there is no communication. Please find enclosed herewith the corresponding docker &amp; yaml files used to containerize and deploy the application</p>

<p>ac6k docker file:</p>

<pre><code>FROM microsoft/aspnetcore-build

EXPOSE 5010

WORKDIR /app

COPY . .

RUN dotnet restore

ENTRYPOINT ["dotnet", "ac6kcore.dll"]




-  ac6kUp.yaml

    apiVersion: v1
    kind: Service
    metadata:
      name: ac6kcore
      labels:
        run: ac6kcore  
    spec:
      type: NodePort
      ports: 
      - port: 5010
        name: ac6kcore
        targetPort: 5010
        nodePort: 32766
        protocol: TCP
      selector:
        run: ac6kcore
    ---
    apiVersion: extensions/v1beta1
    kind: Deployment
    metadata:
      name: ac6kcore
    spec:
      selector:
        matchLabels:
          run: ac6kcore
      replicas: 1
      template:
        metadata:
          labels:
            run: ac6kcore
        spec:
          hostNetwork: true
          containers:
          - image: afierro/ac6kcore:lw
            name: ac6kcore
            ports:
            - containerPort: 5010
          restartPolicy: Always
</code></pre>

<p>local writer docker file:</p>

<pre><code>FROM python:3.6

RUN mkdir -p /mongodbapp

WORKDIR /mongodbapp

COPY requirements.txt /mongodbapp

RUN pip install --no-cache-dir -r requirements.txt

ADD . /mongodbapp

EXPOSE 9090

CMD ["python", "runapp.py"]

- LocalWriter.yaml

apiVersion: v1
kind: Service
metadata:
  annotations:
    service.alpha.kubernetes.io/tolerate-unready-endpoints: "true"
  name: localwriter
  labels:
    app: localwriter
spec:
  type: NodePort
  ports:
  - port: 9090
    name: localwriter
    targetPort: 9090
    nodePort: 32756
    protocol: TCP
  selector:
    app: localwriter
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: localwriter
spec:
  replicas: 1
  selector:
    matchLabels:
      app: localwriter
  template:
    metadata:
      labels:
        app: localwriter
    spec:
      containers:
      - name: flasknode
        image: afierro/localwriter:v1
        imagePullPolicy: Always
        ports:
        - containerPort: 9090
</code></pre>

<p>Thanks in advance</p>

<p>You use service to communicate a pod in one deployment to a pod in another deployment. </p>

<p>Check services here: </p>

<p><a href="https://kubernetes.io/docs/concepts/services-networking/service/" rel="nofollow noreferrer">https://kubernetes.io/docs/concepts/services-networking/service/</a></p>

<p>Make sure you have the right selector in the service. </p>

<p>You can use the env vars that are inside the pod to call the other service. Kubernetes starts the pods with the service ip and port as env vars, to check this you can ssh in a pod and use the command printenv. </p>
