Is there any way to keep a pod operated by a statefulset to COMPLETED state after some logic is executed? I understand that a kubernetes JOB is more suitable for such operation instead of a STATEFULSET but I cannot use a job as I need to use volumeclaimtemplate to create separate pvc for each pod of my application.
Currently after execution of my logic, the pod is going to COMPLETED state but the statefulset is restarting the pod. Even if I delete the statefulset programatically after my logic is executed, the pod is not staying in the COMPLETED state.
Can someone help me with this? Thanks in advance!
You can make the StatefulSet's pods to have an init container that performs your logic and then add a dummy long-running container to prevent the pods from being restarted.