<p>If I want to run multiple replicas of some container that requires a one off initialisation task, is there a standard or recommended practice?</p>

<p>Possibilities:</p>

<ul>
<li>Use a StatefulSet even if it isn't necessary after initialisation, and have init containers which check to see if they are on the first pod in the set and do nothing otherwise. (If a StatefulSet is needed for other reasons anyway, this is almost certainly the simplest answer.)</li>
<li>Use init containers which use leader election or some similar method to pick only one of them to do the initialisation.</li>
<li>Use init containers, and make sure that multiple copies can safely run in parallel. Probably ideal, but not always simple to arrange. (Especially in the case where a pod fails randomly during a rolling update, and a replacement old pod runs its init at the same time as a new pod is being started.)</li>
<li>Use a separate Job (or a separate Deployment) with a single replica. Might make the initialisation easy, but makes managing the dependencies between it and the main containers in a CI/CD pipeline harder (we're not using Helm, but this would be something roughly comparable to a post-install/post-upgrade hook).</li>
</ul>

<p>The fact that "replicas of some container" are dependent on "a one off initialisation task" means that the application architecture does not fit the Kubernetes paradigm well. That is why an involvement of a third-party manager on top of k8s like Helm has to be considered (as suggested by <a href="https://stackoverflow.com/users/7641078/eduardo-baitello">Eduardo Baitello</a> and <a href="https://stackoverflow.com/users/1318694/matt">Matt</a>). </p>

<p>To keep with pure Kubernetes approach, it'd be better to redesign your application so that get it components working as independent or loosely coupled microservices (including initialization tasks). 
A <a href="https://stackoverflow.com/questions/57211216/how-to-wait-for-the-other-container-completed-execution-in-k8s/57272595#57272595">similar question</a> has been discussed here recently. </p>

<p>As for the possibilities listed in the question, perhaps the first option with <a href="https://kubernetes.io/docs/concepts/workloads/pods/init-containers/#init-containers-in-use" rel="nofollow noreferrer">InitContainers</a> and <a href="https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/" rel="nofollow noreferrer">StatefulSets</a> could be feasible in pure Kubernetes. </p>
