Automatic volume expansion
Automatic volume expansion enables Persistent Volumes provisioned by Trident to grow automatically when used capacity reaches a defined threshold. This capability reduces operational overhead and helps prevent application disruption caused by capacity exhaustion.
Automatic volume expansion is implemented using Autogrow Policies. An Autogrow Policy defines:
-
The utilization threshold that triggers expansion
-
The amount by which the volume grows
-
The maximum size the volume can reach
Volumes increase in size automatically when the defined utilization threshold is exceeded. Volumes are never automatically reduced.
Requirements
Before configuring automatic volume expansion, ensure that the following requirements are met:
-
Trident 26.02 or later
-
Role-based access control permissions to create
TridentAutogrowPolicycustom resources -
StorageClasses configured with
allowVolumeExpansion: true -
Supported ONTAP protocols:
-
Network File System
-
Internet Small Computer Systems Interface
-
Fibre Channel Protocol
-
Non-Volatile Memory Express over Fabrics
-
Limitations
-
ONTAP Non-Volatile Memory Express raw block volumes earlier than ONTAP 9.16.1 do not support automatic expansion.
-
For storage area network volumes, if
growthAmountis less than or equal to 50 mebibytes, Trident automatically increases the value to 51 mebibytes before resizing, provided the resulting size does not exceedmaxSize. -
In brownfield environments, automatic expansion might not function for certain existing volumes due to volume publication migration behavior.
-
When a volume reaches
maxSize, no further expansion occurs. -
Supported protocols for automatic volume expansion:
-
Network File System
-
Internet Small Computer Systems Interface
-
Fibre Channel Protocol
-
Non-Volatile Memory Express over Fabrics
-
Provision Volumes with Autogrow Policy
Autogrow Policy can be configured at two levels:
-
Storage class level: Sets default for all volumes (using annotation)
-
PVC level: Overrides storage class default (using annotation)
Create an Autogrow Policy
Autogrow Policies enable automatic volume expansion when volumes reach a defined capacity threshold.
Ensure you have:
-
Trident 26.02 or later installed
-
Role-based access control permissions to create
TridentAutogrowPolicyresources -
Understanding of workload growth requirements
An Autogrow Policy defines how volumes expand automatically when they reach a defined capacity threshold.
You can create Autogrow Policies at any point in your workflow:
-
Before StorageClasses and volumes are created
-
After StorageClasses exist
-
After volumes are provisioned
This flexibility allows you to introduce automatic expansion without recreating existing resources.
Autogrow Policy specifications
Autogrow Policies are Kubernetes custom resources defined as follows:
| Field | Description | Format | Required | Example | Default |
|---|---|---|---|---|---|
name |
Unique policy identifier |
String |
Yes |
production-db-policy |
None |
usedThreshold |
Capacity percentage that triggers expansion |
Percentage string |
Yes |
"80%" |
None |
growthAmount |
Amount to grow when threshold is reached |
Percentage or size |
No |
"10%" or "5Gi" |
"10%" |
maxSize |
Maximum volume size limit |
Kubernetes quantity |
No |
"500Gi" |
Unlimited |
Create an Autogrow Policy
-
Create a YAML file that defines your Autogrow Policy:
apiVersion: trident.netapp.io/v1 kind: TridentAutogrowPolicy metadata: name: standard-autogrow spec: usedThreshold: "80%" growthAmount: "10%" maxSize: "500Gi" -
Apply the policy to your cluster:
kubectl apply -f autogrow-policy.yaml -
Verify that the policy was created:
kubectl get tridentautogrowpolicy standard-autogrowExpected outputNAME USED THRESHOLD GROWTH AMOUNT STATE standard-autogrow 80% 10% Success
Policy states
After you create a policy, Trident validates the specification and assigns one of the following states:
| State | Description | Action required |
|---|---|---|
Success |
Policy is validated and ready to use. |
None. |
Failed |
Validation errors detected. |
Review and fix the specification. |
Deleting |
Deletion is in progress. |
Wait for completion. |
Associate a policy with a StorageClass
You can associate an Autogrow Policy with a StorageClass by using the trident.netapp.io/autogrowPolicy annotation. All volumes provisioned from that StorageClass inherit the policy.
|
|
The StorageClass must have allowVolumeExpansion: true.
|
-
Create or modify a StorageClass with the Autogrow Policy annotation:
apiVersion: storage.k8s.io/v1 kind: StorageClass metadata: name: ontap-gold annotations: trident.netapp.io/autogrowPolicy: "production-db-policy" provisioner: csi.trident.netapp.io parameters: backendType: "ontap-san" fsType: "ext4" allowVolumeExpansion: true -
Apply the StorageClass:
kubectl apply -f storageclass.yaml -
Verify the annotation:
kubectl get storageclass ontap-gold -o jsonpath='{.metadata.annotations.trident\.netapp\.io/autogrowPolicy}'Expected outputproduction-db-policy
Policy precedence
When Autogrow Policy annotations are set on both a StorageClass and a PVC, Trident applies the following precedence rules:
-
PVC annotation takes priority. If a PVC sets
trident.netapp.io/autogrowPolicy, that value is always used. -
StorageClass annotation applies only when the PVC has no annotation.
-
If neither has the annotation, no Autogrow Policy is applied.
| StorageClass annotation | PVC annotation | Effective behavior |
|---|---|---|
|
Not set |
Uses |
|
|
Uses |
|
|
No Autogrow Policy (PVC disables autogrow). |
Not set |
|
Uses |
Not set |
Not set |
No Autogrow Policy. |
Configuration examples
The following examples show common Autogrow Policy configurations for different use cases.
Conservative policy for production databases
apiVersion: trident.netapp.io/v1
kind: TridentAutogrowPolicy
metadata:
name: production-db-policy
spec:
usedThreshold: "75%"
growthAmount: "20%"
maxSize: "5Ti"
Log storage with fixed growth increments
apiVersion: trident.netapp.io/v1
kind: TridentAutogrowPolicy
metadata:
name: log-storage-policy
spec:
usedThreshold: "90%"
growthAmount: "10Gi"
maxSize: "100Gi"
Minimal policy with defaults
When you omit growthAmount and maxSize, Trident uses the defaults (10% growth, unlimited size):
apiVersion: trident.netapp.io/v1
kind: TridentAutogrowPolicy
metadata:
name: logs-policy
spec:
usedThreshold: "85%"
Policy with a custom maxSize and default growthAmount
apiVersion: trident.netapp.io/v1
kind: TridentAutogrowPolicy
metadata:
name: default-ga-policy
spec:
usedThreshold: "70%"
maxSize: "100Gi"
Aggressive growth with unlimited maxSize
apiVersion: trident.netapp.io/v1
kind: TridentAutogrowPolicy
metadata:
name: aggressive-growth-policy
spec:
usedThreshold: "80%"
growthAmount: "150%"
Policy with fractional percentages
apiVersion: trident.netapp.io/v1
kind: TridentAutogrowPolicy
metadata:
name: precise-policy
spec:
usedThreshold: "80.28%"
growthAmount: "10.65%"
maxSize: "100Gi"
|
|
Fractional percentages are supported. If you specify more than three decimal places, Trident rounds the value to three decimal places. |
NAS StorageClass with Autogrow
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: ontap-nas-autogrow
annotations:
trident.netapp.io/autogrowPolicy: "standard-autogrow"
provisioner: csi.trident.netapp.io
parameters:
backendType: "ontap-nas"
fsType: "ext4"
allowVolumeExpansion: true
SAN StorageClass with Autogrow
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: database-storage
annotations:
trident.netapp.io/autogrowPolicy: "production-db-policy"
provisioner: csi.trident.netapp.io
parameters:
backendType: "ontap-san"
fsType: "ext4"
allowVolumeExpansion: true