title: Kubernetes - Unable to connect to a redis pod from another pod on the same cluster
body: <p>Connection between pods on the same cluster is failing.</p>
  
  <p>From what I understand, by default - the pods are exposed on the port specified in the yaml file. For example, I have configured my deployment file for redis as below:</p>
  
  <pre><code>apiVersion: extensions/v1beta1
  kind: Deployment
  metadata:
    name: redis
    labels:
      app: myapp
  spec:
    replicas: 1
    template:
      metadata:
        labels:
          app: myapp
      spec:
        containers:
        - env:
          - name: REDIS_PASS
            value: '**None**'
          image: tutum/redis
          ports:
          - containerPort: 6379
          name: redis
        restartPolicy: Always
  </code></pre>
  
  <p>Below is the deployment file for the pod where the container is trying to access redis:</p>
  
  <pre><code>apiVersion: extensions/v1beta1
  kind: Deployment
  metadata:
    name: jks
    labels:
      app: myapp
  spec:
    replicas: 1
    template:
      metadata:
        labels:
          app: myapp
      spec:
        imagePullSecrets:
        - name: myappsecret
        containers:
        - env:
          - name: JOBQUEUE
            value: vae_jobqueue
          - name: PORT
            value: "80"
          image: repo.url
          name: jks
          ports:
          - containerPort: 80
          volumeMounts:
            - name: config-vol
              mountPath: /etc/sys0
        volumes:
          - name: config-vol
            configMap:
              name: config
  
        restartPolicy: Always
  </code></pre>
  
  <p>I did not create any service yet. But is it required? The pod is going to be accessed by another pod which is part of the same helm chart. With this setup,there are errors in the second pod which tries to access redis:</p>
  
  <pre><code>2018-11-21T16:12:31.939Z - [33mwarn[39m:  Error: Redis connection to redis:6379 failed - getaddrinfo ENOTFOUND redis redis:6379
      at errnoException (dns.js:27:10)
      at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:78:26)
  </code></pre>
  
  <p><em>How do I make sure that my pod is able to connect to the redis pod on port 6379?</em></p>
  
  <p>---- UPDATE ----</p>
  
  <p>This is how my charts look like now: </p>
  
  <pre><code># Source: mychartv2/templates/redis-service.yaml
  apiVersion: v1
  kind: Service
  metadata:
    name: redis
  spec:
    selector:
      app: myapp-redis
    clusterIP: None
    ports:
    - name: redis
      port: 6379
      targetPort: 6379
  ---
  # Source: mychartv2/templates/redis-deployment.yaml
  apiVersion: extensions/v1beta1
  kind: Deployment
  metadata:
    name: redis
    labels:
      app: myapp-redis
  spec:
    replicas: 1
    template:
      metadata:
        labels:
          app: myapp-redis
      spec:
        containers:
        - env:
          - name: REDIS_PASS
            value: '**None**'
          image: tutum/redis
          ports:
          - containerPort: 6379
          name: redis
        restartPolicy: Always
  ---
  # Source: mychartv2/templates/jks-deployment.yaml
  apiVersion: extensions/v1beta1
  kind: Deployment
  metadata:
    name: jks
    labels:
      app: myapp-jks
  spec:
    replicas: 1
    template:
      metadata:
        labels:
          app: myapp-jks
      spec:
        imagePullSecrets:
        - name: jkssecret
        containers:
        - env:
          - name: JOBQUEUE
            value: jks_jobqueue
          - name: PORT
            value: "80"
          image: repo.url
          name: jks
          ports:
          - containerPort: 80
          volumeMounts:
            - name: config-vol
              mountPath: /etc/sys0
        volumes:
          - name: config-vol
            configMap:
              name: jksconfig
  
        restartPolicy: Always
  </code></pre>
  
  <p><strong>Note</strong>: I am using minikube as my kubernetes cluster</p>