<p>I made a Kafka and zookeeper as a statefulset and exposed Kafka to the outside of the cluster. However, whenever I try to delete the Kafka statefulset and re-create one, the data seemed to be gone? (when I tried to consume all the message using <code>kafkacat</code>, the old messages seemed to be gone) even if it is using the same PVC and PV. I am currently using EBS as my persistent volume. </p>

<p>Can someone explain to me what is happening to PV when I delete the statefulset? Please help me.</p>

user11771691
<p>This is the expected behaviour , because the new statefulSet will create a new set of PVs and start over. ( if there is no other choice it can randomly land on old PVs as well , for example local volumes )  </p>

<p>StatefulSet doesn't mean that kubernetes will remember what you were doing in some other old statefulset that u have deleted. </p>

<p>Statefulset means that if the pod is restarted or re-created for some reason, the same volume will be assigned to it. This doesn't mean that the volume will be assigned across the StatefulSets.</p>
