<p>For one POD, three images has been created. The problem here is that there is no communication between containers within same pod. How should my application connected with these three containers?</p>
<p>My pod have below containers.</p>
<pre><code>[dev-application dev-app-nginx dev-app-redis]
</code></pre>
<p>Here I am able see only rails is running but redis and nginx is not running. Because Redis and nix is running as different containers in same pod.</p>
<pre><code>kubectl exec -ti test-deployment-5f59864c8b-mv4kk sh
kubectl exec [POD] [COMMAND] is DEPRECATED and will be removed in a future version. Use kubectl exec [POD] -- [COMMAND] instead.
Defaulting container name to dev-application.
Use 'kubectl describe pod/test-deployment-5f59864c8b-mv4kk -n dev-app' to see all of the containers in this pod.
# rails -v
Rails 4.2.11.3
# redis -v
sh: 2: redis: not found
# nginx -v
sh: 3: nginx: not found
# 
</code></pre>
<p>Below the yam file I am using</p>
<pre><code>apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  namespace: dev-app
  name: test-deployment
spec:
  replicas: 1 
  template:
    metadata:
      labels:
        app: Dev-app
    spec:
      nodeSelector:
       cloud.io/sec-zone-green: &quot;true&quot;
      containers:
        - name: dev-application
          image: hub.docker.net/appautomation/dev.app.1.0:latest
            command: [&quot;/bin/sh&quot;]
            args: [&quot;-c&quot;, &quot;while true; do echo test; sleep 20;done&quot;]
          resources:
            limits:
              memory: 8Gi
              cpu: 5
            requests:
              memory: 8Gi
              cpu: 5
          ports:
            - containerPort: 3000
        - name: dev-app-nginx
          image: hub.docker.net/appautomation/dev.nginx.1.0:latest
          resources:
            limits:
              memory: 4Gi
              cpu: 4
            requests:
              memory: 4Gi
              cpu: 4
          ports:
            - containerPort: 80
                       
        - name: dev-app-redis
          image: hub.docker.net/appautomation/dev.redis.1.0:latest
          
          resources:
            limits:
              memory: 4Gi
              cpu: 4
            requests:
              memory: 4Gi
              cpu: 4
          ports:
            - containerPort: 6379
    
        
</code></pre>

<p>Use <strong>localhost</strong> to communicate with other containers within the same pod.</p>
<p>E.g. the addresses to the containers are</p>
<ul>
<li>127.0.0.1:3000</li>
<li>127.0.0.1:80</li>
<li>127.0.0.1:6379</li>
</ul>
