kube-rename

This is a simple MutatingAdmissionWebhook for Kubernetes that adds an ordinal integer id suffix to the name of newly created pods with the kube-rename.minekube.com: true label.

Problem:

We need to schedule pods that have a sequential ordinal in their name (e.g. to give them a predictable identity that the pod can parse from the POD_NAME env). We could use a StatefulSet, but we need the parallel rolling update mechanism that the Deployment controller provides.

Solution:

Use any controller including Deployment and intercept the pod creation and prepend the ordinal suffix to the pod’s generateName.

GitHub

View Github