<p>Here's the <a href="https://github.com/kubernetes/kubernetes/tree/master/examples/storage/redis" rel="nofollow noreferrer">example</a> I have modeled after.</p>

<p>In the Readme's "Delete our manual pod" section:</p>

<blockquote>
  <ol start="3">
  <li>The redis sentinels themselves, realize that the master has disappeared from the cluster, and begin the election procedure for selecting a new master. They perform this election and selection, and chose one of the existing redis server replicas to be the new master.</li>
  </ol>
</blockquote>

<p>How do I select the new master? All 3 Redis server pods controlled by the <code>redis</code> replication controller from <code>redis-controller.yaml</code> still have the same</p>

<pre><code>labels:
  name: redis
</code></pre>

<p>which is what I currently use in my Service to select them. How will the 3 pods be distinguishable so that from Kubernetes I know which one is the master?</p>

<blockquote>
  <p>How will the 3 pods be distinguishable so that from Kubernetes I know
  which one is the master?</p>
</blockquote>

<p>Kubernetes isnt aware of the master nodes. You can find the pod manually by  connecting to it and using:</p>

<pre><code>redis-cli info
</code></pre>

<p>You will get lots of information about the server but we need role for our purpose:</p>

<pre><code>redis-cli info | grep ^role
Output:
role: Master
</code></pre>

<p>Please note <code>Replication controllers</code> are replaced by <code>Deployments</code> for stateless services. For stateful services use <code>Statefulsets</code>. </p>
