<p>How does a StatefulSet ensure that a PersistentVolume and Pod will always be provisioned in the same Availability Zone? I understand that each pod in a StatefulSet has a storage identity, and that each pod will remember the PVC it is using, but am struggling to find the official documentation to support this.</p>

user55691
<blockquote>
<p>pod will remember the PVC it is using, but am struggling to find the
official documentation to support this</p>
</blockquote>
<p>I think here is the exact line you are looking for</p>
<blockquote>
<p>You can set the .spec.volumeClaimTemplates which can provide stable
storage using PersistentVolumes provisioned by a PersistentVolume
Provisioner.</p>
</blockquote>
<p>Ref doc : <a href="https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/#volume-claim-templates" rel="nofollow noreferrer">https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/#volume-claim-templates</a></p>
<p>The general flow goes like</p>
<p>You have <strong><a href="https://kubernetes.io/docs/concepts/storage/storage-classes/" rel="nofollow noreferrer">StorageClass</a></strong>(backed by csi) which list of <strong>zones</strong> K8s goes <strong>round robin</strong> to create the <strong>PV</strong></p>
<p>Based on the <strong>PVC</strong> pod access the <strong>volume</strong> and schedule to AZ</p>
