<p>I am looking on how can I change the parameter of containers depending on the number of replica ?</p>

<p>For example, I would like to have an environment variable ( which is the name of my hubot)  as follow :</p>

<ol>
<li>First Replica : Name1</li>
<li>Second replica : Name2...</li>
</ol>

<p>Do you have an idea of how can I achieve that ?
Thanks !</p>

<p>The feature is called "<a href="https://kubernetes.io/docs/concepts/workloads/controllers/statefulset" rel="nofollow noreferrer">StatefulSets</a>" in Kubernetes. Have a look at the <a href="https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/#stable-network-id" rel="nofollow noreferrer">Stable Network ID</a> section in particular.</p>

<p>Stateful sets are available in Kubernetes 1.5. If you need an older version, you could use some kind of central registry like <a href="https://redis.io/commands/incr" rel="nofollow noreferrer">redis</a> instead and implement some logic where new pods request the next free number when they start.</p>
