<p>I have a backend pod running a quite migration script on startup (1 minute or more). How to avoid K8s thinks that the pods failed to start and tries to re-launch it? </p>

pditommaso
<p>I'm assuming you have a liveness probe set on your Pod. This is what k8s is looking at when it decides whether a pod needs restarted. You can fix this by setting the <code>initialDelaySeconds</code> attribute on your script to something beyond the length of time the migration script needs to run.
<a href="https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/" rel="nofollow noreferrer">https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/</a></p>

<p>An alternative is to use an initContainer for the Pod that runs the migration script. This is what init containers are used for.
<a href="https://kubernetes.io/docs/concepts/workloads/pods/init-containers/" rel="nofollow noreferrer">https://kubernetes.io/docs/concepts/workloads/pods/init-containers/</a></p>
