Kubernetes Redis HA and exposing redis to things outside of the container Kubernetes Redis HA and exposing redis to things outside of the container kubernetes kubernetes

Kubernetes Redis HA and exposing redis to things outside of the container


The redis sentinel service file from your link (https://github.com/kubernetes/kubernetes/blob/master/examples/storage/redis/redis-sentinel-service.yaml) will expose the pods within the cluster. For external access (from outside your cluster) you can use a NodePort:

apiVersion: v1kind: Servicemetadata:  labels:    name: sentinel    role: service  name: redis-sentinelspec:  type: NodePort  ports:    - port: 26379      targetPort: 26379      nodePort: 30369  selector:    redis-sentinel: "true"

This would expose the port 30369 on all your hosts from the outside world to the redis sentinel service.

Several remarks on this:* Firewall: Security in redis is limited, so prevent unwanted access before opening the port* The allowed to be assigned nodePort range is from 30000 to 32767, so be creative with this limitation.