<p>I have few questions regarding how a random string part in kubernetes podname is decided .</p>
<p>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 ??</p>
<p>The reason for asking this, we are storing the complete pod name in database and it cannot exceed certain character length.</p>
<p>Most of the times i have seen the length is 10 characters. Can it go beyond 10 characters ??</p>

<p>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.</p>
<p>The name structure of a Pod will be different depending on the controller type:</p>
<ul>
<li>StatefulSet: StatefulSet name + &quot;-&quot; + ordinal number starting from 0</li>
<li>DaemonSet: DaemonSet name + &quot;-&quot; + 5 alphanumeric characters long string</li>
<li>Deployment: ReplicaSet name (which is Deployment name + &quot;-&quot; + 10 alphanumeric characters long string) + &quot;-&quot; + 5 alphanumeric characters long string</li>
</ul>
<p>But then, the full name of the Pods will also include the name of their controllers, which is rather arbitrary.</p>
<p>So, how do you proceed?</p>
<p>You just have to prepare the length of the column to be <a href="https://unofficial-kubernetes.readthedocs.io/en/latest/concepts/overview/working-with-objects/names/" rel="nofollow noreferrer">the maximum length of a  pod name, which is <strong>253 characters</strong></a>.</p>
