title: How can I connect to Redis outside the cluster using Istio?
body: <p>I installed Redis inside my Google Kubernetes Engine cluster using helm and it is working:</p>
  <pre><code>kubectl get svc -n redis-system
  
  NAME             TYPE        CLUSTER-IP    EXTERNAL-IP   PORT(S)    AGE
  redis-headless   ClusterIP   None          &lt;none&gt;        6379/TCP   99d
  redis-master     ClusterIP   10.0.30.29    &lt;none&gt;        6379/TCP   99d
  redis-slave      ClusterIP   10.0.31.102   &lt;none&gt;        6379/TCP   99d
  </code></pre>
  <p>I can connect to it using kubectl but now I want to use redis-cli in my local machine and connect directly to it. Then, I created a Gateway and a VirtualService using Istio:</p>
  <pre><code>apiVersion: networking.istio.io/v1alpha3
  kind: Gateway
  metadata:
    name: redis-gateway
    namespace: istio-system
  spec:
    selector:
      istio: ingressgateway
    servers:
    - port:
        number: 80
        name: redis-port
        protocol: TCP
      hosts:
      - redis-hm.myhost.com.br
  ----------------------------------------------------------------
  apiVersion: networking.istio.io/v1alpha3
  kind: VirtualService
  metadata:
    name: redis-virtual-service
    namespace: istio-system
  spec:
    hosts:
    - redis-hm.myhost.com.br
    gateways:
    - istio-system/redis-gateway
    tcp:
      - route:
        - destination:
            host: redis-master.redis-system.svc.cluster.local
            port:
              number: 6379
  </code></pre>
  <p>When I use the following command it connects to the host:</p>
  <pre><code>redis-cli -h redis-hm.myhost.com.br -p 80 -a mypassword
  </code></pre>
  <p>But when I use the command <strong>ping</strong> it returns:</p>
  <pre><code>Error: Protocol error, got &quot;H&quot; as reply type byte
  </code></pre>
  <p>If possible I would like to solve this problem only using yml files to be applied using kubectl without editing anything in Istio. Thanks.</p>