So, I am learning how to use Kubernetes for my business. I installed it and played a little.
The question is, when the replication controller starts a couple of replicas, they have something like id in their name:
- How unique is this identifier? Is it unique to the life of the kubernets? Is it unique for different launches of kubernets (i.e. if I restart kubernets)?
- How to transfer this identifier to the application in the container? Can I specify some kind of template in yaml, for example, the identifier will be assigned to an environment variable or something like that?
- Alternatively, is there a way for an application in a container to request this identifier?
A more detailed description of the use case. I have an application that writes some session files inside a directory. I want to guarantee the uniqueness of session identifiers in the system. This means that if one instance of the application is running on VM1 and another instance on VM2, I want to add some kind of identifier to identifiers like app-1-dajk4l and app-2-dajk4l, where the application is the name of the application and 1, 2 - the identifier of the instance that should come from the replication controller, because it is dynamic and cannot be configured manually. dajk4l is some identifier similar to the current timestamp or the like.
Thanks.
bobef source share