<p>I need to start by saying that I have no experience using Cassandra and I am not the one who who created this deployment.</p>
<p>I have Cassandra running in a cluster in AKS. The PVC as configured in the statefulset is 1000Gi. Currently the pods are out of storage and are in a constant unhealthy state.</p>
<p>I am looking to expand the volumes attached to the pods. The problem I am facing is that I cannot scale down the statefulset because the statefulsets only scale down when <em>all</em> their pods are healthy.</p>
<p>I even tried deleting the statefulset and then recreateing it with a larger PVC (as recomended <a href="https://adamrushuk.github.io/increasing-the-volumeclaimtemplates-disk-size-in-a-statefulset-on-aks" rel="nofollow noreferrer">here</a>)</p>
<p>Howerver, I can't seem to delete the statefulset. It looks to me like the CassandraDatacenter CRD keeps recreating the statefulset as soon as I delete it. Giving me no time to change anything.</p>
<p>My question are as follows:</p>
<ol>
<li>Is there a standard way to expand the volume without losing data?</li>
<li>What would happen if I scale down the replicas in the CassandraDatacenter? Will it delete the PVC or keep it?</li>
<li>If there is no standard, does anyone have any ideas on how to accomplish expanding the volume size without losing storage?</li>
</ol>

<p>Answer for: <strong>How can I expand a PVC for StatefulSet on AKS without loosing data?</strong></p>
<p>While the answer of @Erick Raminez is a very good advice for Cassandra specific, I would like to answers the more general question &quot;How can I expand a PVC for my StatefulSet on AKS without loosing data?&quot;.</p>
<p>If downtime is allowed, you can follow these 4 steps:</p>
<pre class="lang-sh prettyprint-override"><code># Delete StatefulSet 
# This is required on AKS since the azure disk must have status &quot;Unattached&quot; 
kubectl delete statefulsets.apps STATEFULSET_NAME

# Edit capacity in 
# - your statefulset yaml file
# - each pvc
kubectl patch pvc PVC_NAME -p '{&quot;spec&quot;: {&quot;resources&quot;: {&quot;requests&quot;: {&quot;storage&quot;: &quot;3Gi&quot;}}}}'

# Deploy updated statefulset yaml (or helm chart)
kubectl apply -f statefulset.yaml

# Verify Capacity
kubectl get pvc

</code></pre>
<p>If you don't want downtime, check the first reference for some additional steps.</p>
<p>References:</p>
<ul>
<li><a href="https://adamrushuk.github.io/increasing-the-volumeclaimtemplates-disk-size-in-a-statefulset-on-aks/" rel="nofollow noreferrer">https://adamrushuk.github.io/increasing-the-volumeclaimtemplates-disk-size-in-a-statefulset-on-aks/</a></li>
<li><a href="https://serverfault.com/a/989665/561107">https://serverfault.com/a/989665/561107</a></li>
</ul>
