I'm using StatefulSet in kubernetes, and need to get ordinal index of pod.
I tried to export in postStart.exec.command
, but it doesn't work for me.
Here is my code I tried.
lifecycle:
postStart:
exec:
command: ["/bin/sh", "-c", "export INDEX=${POD_NAME##*-}"]
How can I export ordinal index?