<p>I've created an YAML file with three images in one pod (they need to communicate with eachother over 127.0.0.1) It seems that it's all working. I've defined a nodeport in the yaml file.</p>

<p>There is one deployment defined <code>applications</code> it contains three images:</p>

<ul>
<li>contacts-db (A MySQL database)</li>
<li>front-end (An Angular website)</li>
<li>net-core (An API)</li>
</ul>

<p>I've defined three services, one for every container. In there I've defined the type <code>NodePort</code> to access it.</p>

<p>So I retrieved the services to get the port numbers:</p>

<pre><code>NAME          CLUSTER-IP       EXTERNAL-IP   PORT(S)          AGE
contacts-db   10.103.67.74     &lt;nodes&gt;       3306:30241/TCP   1d
front-end     10.107.226.176   &lt;nodes&gt;       80:32195/TCP     1d
net-core      10.108.146.87    &lt;nodes&gt;       5000:30245/TCP   1d
</code></pre>

<p>And I navigate in my browser to http://:32195 and it just keeps loading. It's not connecting. This is the complete Yaml file:</p>

<pre><code>---
apiVersion: v1
kind: Namespace
metadata:
  name: three-tier
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: applications
  labels:
    name: applications
  namespace: three-tier
spec:
  replicas: 1
  template:
    metadata:
      labels:
        name: applications
    spec:
      containers:
      - name: contacts-db
        image: mysql/mysql-server #TBD
        env:
          - name: MYSQL_ROOT_PASSWORD
            value: quintor
          - name: MYSQL_DATABASE
            value: quintor #TBD
        ports:
        - name: mysql
          containerPort: 3306
      - name: front-end
        image: xanvier/angularfrontend #TBD
        resources:
          requests:
            cpu: 100m
            memory: 100Mi
        ports:
        - containerPort: 80
      - name: net-core
        image: xanvier/contactsapi #TBD
        resources:
          requests:
            cpu: 100m
            memory: 100Mi
        ports:
        - containerPort: 5000
---
apiVersion: v1
kind: Service
metadata:
  name: contacts-db
  labels:
    name: contacts-db
  namespace: three-tier
spec:
  type: NodePort
  ports:
    # the port that this service should serve on
  - port: 3306
    targetPort: 3306
  selector:
    name: contacts-db
---
apiVersion: v1
kind: Service
metadata:
  name: front-end
  labels:
    name: front-end
  namespace: three-tier
spec:
  type: NodePort
  ports:
  - port: 80
    targetPort: 80 #nodePort: 30001
  selector:
    name: front-end
---
apiVersion: v1
kind: Service
metadata:
  name: net-core
  labels:
    name: net-core
  namespace: three-tier
spec:
  type: NodePort
  ports:
  - port: 5000
    targetPort: 5000 #nodePort: 30001
  selector:
    name: net-core
---
</code></pre>

<p>The selector of a service is matching the labels of your pod. In your case the defined selectors point to the containers which leads into nothing when choosing pods.</p>

<p>You'd have to redefine your services to use one selector or split up your containers to different Deployments / Pods.</p>

<p>To see whether a selector defined for a services would work, you can check them with:</p>

<pre><code>kubectl get pods -l key=value
</code></pre>

<p>If the result is empty, your services will run into the void too.</p>
