run a task in only ONE pod (of multiple pods)

4/7/2020

I am trying to run a process in only ONE docker pod (and not the other n pods),

can I know (from inside a pod/instance)

  • am I the first pod?
  • how many pods are running?

thanks.

-- BarganBanananas
docker
kubernetes
rancher

1 Answer

4/8/2020

Don't do this. Put that thing in its own deployment (or statefulset more likely) that is unrelated to the others.

-- coderanger
Source: StackOverflow