'How does Random String in Kubernetes pod Name decided
I have few questions regarding how a random string part in kubernetes podname is decided .
how is pod-template-hash decided ?? ( i understand that it is a random string generated by deployment controller). But exactly what are the inputs which the deployment controller considers before generating this random string . is there a maximum length this hash string will limit to ??
The reason for asking this, we are storing the complete pod name in database and it cannot exceed certain character length.
Most of the times i have seen the length is 10 characters. Can it go beyond 10 characters ??
Solution 1:[1]
10 characters? That is only the alphanumeric suffix of the replica set name. Pods under a replica set will have additional suffixes of a dash plus 5 characters long alphanumeric string.
The name structure of a Pod will be different depending on the controller type:
- StatefulSet: StatefulSet name + "-" + ordinal number starting from 0
- DaemonSet: DaemonSet name + "-" + 5 alphanumeric characters long string
- Deployment: ReplicaSet name (which is Deployment name + "-" + 10 alphanumeric characters long string) + "-" + 5 alphanumeric characters long string
But then, the full name of the Pods will also include the name of their controllers, which is rather arbitrary.
So, how do you proceed?
You just have to prepare the length of the column to be the maximum length of a pod name, which is 253 characters.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Lukman |
