Auto-seeding replica labels

7/18/2018

Is it possible to assign a unique seeded label to every instance/replica of a pod created by ReplicationController.
So if RC is set up to launch 4 replicas of a pod ABC - the replicas would have a label ABC-1,ABC-2 etc.
Help is appreciated

-- IUnknown
kubernetes
openshift

1 Answer

7/30/2018

As mentioned by @Graham, in your case it is a good idea to use StatefulSet:

StatefulSets use an ordinal index for the identity and ordering of their Pods. By default, StatefulSet Pods are deployed in sequential order and are terminated in reverse ordinal order. For example, a StatefulSet named web has its Pods named web-0, web-1, and web-2. When the web Pod specification is changed, its Pods are gracefully stopped and recreated in an ordered way; in this example, web-2 is terminated first, then web-1, and so on.

-- VKR
Source: StackOverflow