Connect to redis instance from Istio enabled pod in a EKS cluster

4/10/2020

I am running a EKS cluster with Istio enabled. I have launched an EC2 instance, where a redis server is running. EKS cluster and Redis both are in same VPC. All Inbound and Outbound rules allowed for both of them. But, When I am trying to access the redis instance inside of a pod, it is throwing "Connection reset by peer", while it is working fine from non-istio pod. What could be the reason ?

Istio Version :-

image: docker.io/istio/pilot:1.4.3
imagePullPolicy: IfNotPresent
image: docker.io/istio/proxyv2:1.4.3
imagePullPolicy: IfNotPresent

I have also created a Serviceentry in that namespace .

apiVersion: networking.istio.io/v1alpha3
kind: ServiceEntry
metadata:
  name: svc-redis
  namespace: mynamespace
spec:
  hosts:
    - "redis-X.xxx.xxxx"
  location: MESH_EXTERNAL
  ports:
    - number: 6379
      name: http
      protocol: REDIS
  resolution: NONE
-- codekube
amazon-eks
amazon-web-services
istio
kubernetes
redis

1 Answer

4/10/2020

As you are using the Domain name as a host, so you need to set the resolution to DNS. Because When you set the resolution to None. It will try to connect to an IP address instead of using the domain name.

Here is my service entry for external Redis access.

apiVersion: networking.istio.io/v1alpha3
kind: ServiceEntry
metadata:
  name: redis-svc
spec:
  hosts:
  - redis01.example.com
  ports:
  - number: 6379
    name: redis
    protocol: TCP
  resolution: DNS
  location: MESH_EXTERNAL
-- Dinesh Katwal
Source: StackOverflow