Increase Persistent Volume (PV) size for StatefulSets
Learn how to increase the PV size for StatefulSets in your Kubernetes cluster during a Helm upgrade.
You can manually update the Persistent Volume (PV) size associated with a StatefulSet in your Kubernetes clusters. This topic describes how to increase the PV size for StatefulSets in your Kubernetes clusters during a Helm upgrade.
For more information on Helm upgrades, go to Upgrade the Helm chart.
Prerequisite
Ensure your storage class supports volume expansion. Refer to the documentation for your volume driver:
AWS:
ebs.csi.aws.comsupports volume expansion.GCP:
pd.csi.storage.gke.iosupports volume expansion.Other Drivers: Check the specific documentation for your storage class.
Install
yqif you plan to use Method 1.Ensure you have the necessary permissions to delete StatefulSets and perform Helm upgrades.
Recommendation
Take a Backup: Before proceeding, create a backup to ensure data can be restored in case of failures. Refer to Back up and restore Harness for guidance.
Method 1: Using shell script
Download the Shell Script
Make the script executable:
Run the script and provide the required arguments:
Example:
Wait for the script to complete successfully.
Method 2: Manually Update the PV size for StatefulSets
Follow these steps to manually increase PV size associated with a StatefulSet in your Kubernetes cluster manually:
Run the following command to list all the Persistent Volume Claims (PVCs) in your Kubernetes cluster.
Identify the PV that corresponds to the StatefulSet you are currently working with.
Edit the PV configuration to update the storage size. Replace
<YOUR_PVC_NAME>with the name of your PVC and<YOUR_UPDATED_SIZE>with the desired storage size.Verify that the PV and PVC have been updated with the new size. Replace
<YOUR_PV_NAME>and<YOUR_PVC_NAME>with your applicable names.Edit the storage values in the values
override.yamlfile you use to deploy Helm to reflect the new requirements.When upgrading storage for TimescaleDB, the values will look similar to the example below:
Ensure the StatefulSet is recreated to pick up the changes. Replace
<YOUR_STATEFULSET-NAME>,<YOUR_RELEASE_NAME>, and<YOUR_CHART_NAME>with your StatefulSet name, Helm release name, and Helm chart name, and change theoverride.yamlfile name.
Troubleshoot
If database pods fail to come online or restart frequently, try these steps:
Adjust Probes: Increase the readiness/liveness probe timeout values for the StatefulSet.
Scale Down and Up: Scale down the database StatefulSet to zero pods, then scale it back to one pod. After the master pod is stable, scale it further as needed.
Restore Data: Restore the database from a backup if taken earlier.
Contact Support: If issues persist, reach out to Harness support for assistance.
Last updated
Was this helpful?