containers icon indicating copy to clipboard operation
containers copied to clipboard

[bitnami/redis] How to expose the redis cluster in k8s from other network ( outside of k8s)

Open dinesh-github-ops opened this issue 1 year ago • 7 comments

Name and Version

bitnami/redis:7.4.0-debian-12-r2

What architecture are you using?

amd64

What steps will reproduce the bug?

Not sure

What is the expected behavior?

We installed redis on our on prem k8s cluster and all pods are running. But I want to expose this to outside of k8s so that application can use this redis.

What do you see instead?

I am unable to see any document to expose the redis from outside of k8s

Additional information

We installed redis on our on prem k8s cluster and all pods are running. But I want to expose this to outside of k8s so that application can use this redis.

dinesh-github-ops avatar Aug 22 '24 13:08 dinesh-github-ops

Hi,

Did you set the *.service.type values to LoadBalancer?

javsalgar avatar Aug 23 '24 07:08 javsalgar

Hi,

I did not set anything in values.yaml file for load balancer. below are existing services for redis

yipee-kiya-redis-headless   ClusterIP   None           <none>        6379/TCP   35h
yipee-kiya-redis-master     ClusterIP   10.43.195.16   <none>        6379/TCP   35h
yipee-kiya-redis-replicas   ClusterIP   10.43.54.63    <none>        6379/TCP   35h

dinesh-github-ops avatar Aug 23 '24 09:08 dinesh-github-ops

You need to set the adequate service type for your use case, see https://kubernetes.io/docs/concepts/services-networking/service/#publishing-services-service-types

carrodher avatar Aug 26 '24 12:08 carrodher

Hi,

I configured redis service with type "load balancer" but I am getting the below error while typing any command using redis-cli

redis.k8s.abcdef.com:443> ping
Error: Protocol error, got "H" as reply type byte

below is my redis-service yaml file:

apiVersion: v1
kind: Service
metadata:
  name: redis-service
spec:
  selector:
    app.kubernetes.io/name: redis      
  type: LoadBalancer
  ports:
    - protocol: TCP      
      port: 443
      targetPort: 6379
  selector:
    app: redis

dinesh-github-ops avatar Aug 27 '24 08:08 dinesh-github-ops

Are you using TLS? Can you provide more information about the deployment (e.g. Helm chart values)?

And are you sure that there's not an HTTP(S) loadbalancer in front of the whole thing? Port 443 looks suspicious.

simonhammes avatar Aug 27 '24 18:08 simonhammes

Hi,

I am not using TLS, I just tried to send request from out side to port 443 and then internally it goes to 6379. In our environment we cant open 6379 port from outside to k8s cluster and we only allow port 443/80/8080 port. thats why I used 443 port. below is value.yaml

When I try to test using redis-cli on port 443 I got this error: Error: Protocol error, got "H" as reply type byte

redis-value.txt

Please find the attached value.yaml file.

dinesh-github-ops avatar Aug 29 '24 05:08 dinesh-github-ops

Okay. That's odd.

I tried this out on my own cluster using the Helm chart and the following (minimal) values file:

auth:
  password: "some-password"

master:
  service:
    type: "LoadBalancer"
    ports:
      redis: 6666

kubectl get svc shows the external IP address and I can connect from my local machine using redis-cli -h $IP -p 6666 and ping the server without any issues.


Oddly enough, I get the exact same error message (Error: Protocol error, got "H" as reply type byte) when I try to connect to port 443. And there's a Traefik Ingress Controller running on my cluster on port 443...


EDIT: Can you maybe provide the output of kubectl get svc (-A)?

simonhammes avatar Aug 29 '24 21:08 simonhammes

This Issue has been automatically marked as "stale" because it has not had recent activity (for 15 days). It will be closed if no further activity occurs. Thanks for the feedback.

github-actions[bot] avatar Sep 14 '24 01:09 github-actions[bot]

Due to the lack of activity in the last 5 days since it was marked as "stale", we proceed to close this Issue. Do not hesitate to reopen it later if necessary.

github-actions[bot] avatar Sep 19 '24 01:09 github-actions[bot]