Managing Persistent Volumes and Resizing with ArgoCD: What’s the Best Approach?
Asked by
MaverickPineapple72
I'm new to Kubernetes and currently experimenting with ArgoCD on an AWS EKS Cluster. While I think I've got the hang of creating custom storage classes like EBS CSI and enabling resizing, I'm still a bit puzzled about how to manage this with StatefulSets. I understand that I can change the PVC in my Git repository, and ArgoCD will pick that up to resize it without restarting my pods. However, when it comes to resizing PVCs associated with a StatefulSet, it seems I need to patch the PVC manually, and those changes won't show in my Git repo. Plus, if I'm using Helm charts that deploy PVCs, how do I determine which storage class they use and manage resizing? Any insights would be super helpful!
Answers
Actually, the correct way is to use the volumeClaimTemplate in your StatefulSet. If you want to resize PVCs, you will need to update the claim template and let ArgoCD apply those changes. However, you're correct—it can get tricky since you can’t directly resize a PVC that’s tied to a StatefulSet without some workarounds. Kubernetes is working on allowing easier updates through StatefulSets in future releases, so keep an eye out for that!
Reply to this answer
Right, if your PVCs are created from a StatefulSet template, manual edits are necessary. Just remember, updates on those PVCs from the claim template won’t work directly. You have to modify them manually in the cluster and pull those changes to Git to keep ArgoCD in sync.
Reply to this answer
To manage PVCs for StatefulSets, you'll need to edit it manually since changes won’t reflect back to your Git repo. The best approach is to set the ignore field in your ArgoCD application for the StatefulSet size, then handle the resizing through the CLI or Argo UI.
Reply to this answer
Add your answer
Answers are reviewed before publication.
QuickLearner: So, if I follow your steps, I’d need to delete the StatefulSet while ensuring the pods keep running, then update the PVC size and let Argo redeploy the StatefulSet with the bigger PVCs. Sounds like a plan!
GadgetGeek: Yeah, it sounds like a bit of a hassle, but at least I know I won’t be losing my pods in the process! Thanks for breaking that down!