Search code examples
pythonrandomuuid

Can uuid4 collide when generated by python processes on different kubernetes pods


When having replicas of the same pod with a single container running a single python process on kubernetes, will each python process still generate uuid.uuid4() ids that are practically unique across the all pods or can it happen that 2 python processes are using the same seed when calling the os.urandom function?


Solution

  • os.urandom() method is used to generate a string of size random bytes suitable for cryptographic use or we can say this method generates a string containing random characters. The probability of setting the same seed with os.urandom() is extremely low.

    You should be safe ;)