<p>I am trying to learn docker and kubernetes and one of the things I am trying to do is setup Redis with Sentinel and expose redis to things outside the container. </p>

<p>Getting redis and sentinel setup was pretty easy following 
<a href="https://github.com/kubernetes/kubernetes/tree/master/examples/storage/redis" rel="nofollow noreferrer">https://github.com/kubernetes/kubernetes/tree/master/examples/storage/redis</a></p>

<p>But now my next desire is to be able to access redis outside the container and I can't figure out who to expose sentinel and the master pod.</p>

<p>The redis sentinel service file from your link (<a href="https://github.com/kubernetes/kubernetes/blob/master/examples/storage/redis/redis-sentinel-service.yaml" rel="nofollow noreferrer">https://github.com/kubernetes/kubernetes/blob/master/examples/storage/redis/redis-sentinel-service.yaml</a>) will expose the pods within the cluster. For external access (from outside your cluster) you can use a <strong>NodePort</strong>:</p>

<pre><code>apiVersion: v1
kind: Service
metadata:
  labels:
    name: sentinel
    role: service
  name: redis-sentinel
spec:
  type: NodePort
  ports:
    - port: 26379
      targetPort: 26379
      nodePort: 30369
  selector:
    redis-sentinel: "true"
</code></pre>

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

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