You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This option is deprecated and will be removed in version 1.5.0. Use the [`storageScaling.enableVolumeScaling`](#storagescalingenablevolumescaling) option instead.
75
+
76
+
## Storage scaling section
77
+
78
+
The `storageScaling` section in the [deploy/cr.yaml :octicons-link-external-16:](https://github.com/percona/percona-server-mysql-operator/blob/v{{release}}/deploy/cr.yaml) file controls volume expansion and automatic storage resizing for MySQL PVCs. See [Scale storage](scaling.md#scale-storage) for usage details.
79
+
80
+
### `storageScaling.enableVolumeScaling`
81
+
82
+
Enables or disables [storage scaling / volume expansion](scaling.md#storage-resizing-with-volume-expansion-capability) with Volume Expansion capability.
Enables automatic storage resizing based on user-defined thresholds. Read more about this feature in [Automatic storage resizing](scaling.md#automatic-storage-resizing).
@@ -43,21 +43,32 @@ for more details about other components.
43
43
44
44
### Scale storage
45
45
46
-
Kubernetes manages storage with a PersistentVolume (PV), a segment of
47
-
storage supplied by the administrator, and a PersistentVolumeClaim
48
-
(PVC), a request for storage from a user.
46
+
Kubernetes manages storage with the following components:
49
47
50
-
Starting with Kubernetes v1.11, a user can increase the size of an existing
48
+
* a PersistentVolume (PV) - a segment of
49
+
storage supplied by the Kubernetes administrator,
50
+
* a PersistentVolumeClaim
51
+
(PVC) - a request for storage from a user.
52
+
53
+
Starting with Kubernetes v1.11, you can increase the size of an existing
51
54
PVC object (considered stable since Kubernetes v1.24).
52
-
The user cannot shrink the size of an existing PVC object.
55
+
Note that you **cannot shrink** the size of an existing PVC object.
56
+
57
+
Use storage scaling to keep up with growing data while keeping the cluster online. The Operator supports the following scaling options:
58
+
59
+
* automatic scaling - Starting with Operator version 1.2.0, the Operator monitors storage usage and scales the storage automatically
60
+
* storage resizing with Volume Expansion capability - Starting with the Operator version 0.11.0, you can instruct the Operator to scale the storage by updating the Custom Resource manifest
61
+
* manual scaling - scale the storage manually.
53
62
54
-
Starting from the Operator version 0.11.0, you can scale Percona Server for MySQL storage automatically by configuring the Custom Resource manifest. Alternatively, you can scale the storage manually. For either way, the volume type must support PVCs expansion.
63
+
You can also use an external autoscaler with the Operator. Enabling an external autoscaler disables the Operator's internal logic for automatic storage resizing. Choose one method based on your environment and requirements; using both simultaneously is not supported.
64
+
65
+
For either option, the volume type must support PVCs expansion.
55
66
56
67
#### Check expansion capability for your volume type
57
68
58
69
Certain volume types support PVCs expansion by default. You can run the following command to check if your storage supports the expansion capability:
59
70
60
-
```{.bash data-prompt="$" }
71
+
```
61
72
$ kubectl describe sc <storage class name> | grep AllowVolumeExpansion
62
73
```
63
74
@@ -71,13 +82,92 @@ Find exact details about
71
82
PVCs and the supported volume types in [Kubernetes
Starting with version 1.2.0, the Operator can automatically resize Persistent Volume Claims (PVCs) for Percona Server for MySQL Pods based on your configured thresholds. The Operator monitors storage usage of MySQL PVCs. When the usage exceeds the defined threshold, the Operator triggers resizing until the storage size reaches the maximum limit.
88
+
89
+
This feature gives you:
90
+
91
+
* fewer outages from full disks because storage grows with demand
92
+
* less guesswork on capacity planning and fewer last-minute fixes
93
+
* lower operational effort for developers and platform engineers
94
+
* cost control by expanding only when needed
95
+
* a more predictable environment so teams can focus on delivery
96
+
97
+
To enable automatic storage resizing, edit the `deploy/cr.yaml` Custom Resource manifest as follows:
98
+
{.power-number}
99
+
100
+
1. Make sure the MySQL component has a storage size set.
101
+
102
+
Example:
103
+
104
+
```yaml
105
+
spec:
106
+
mysql:
107
+
volumeSpec:
108
+
persistentVolumeClaim:
109
+
resources:
110
+
requests:
111
+
storage: 6Gi
112
+
```
113
+
114
+
2. Configure autoscaling thresholds in the [`storageScaling`](operator.md#operator-storagescaling-section) subsection:
115
+
116
+
* `enableVolumeScaling` - set to `true`. This replaces the deprecated [`enableVolumeExpansion`](operator.md#enablevolumeexpansion) option and must be enabled for autoscaling to work
117
+
* `autoscaling.enabled` - set to `true`
118
+
* `autoscaling.triggerThresholdPercent` - specify the usage percentage (50–95, default `80`). When usage exceeds this threshold, autoscaling is triggered
119
+
* `autoscaling.growthStep` - specify how much storage to add on each resize (default `2Gi`)
120
+
* `autoscaling.maxSize` - specify the upper limit for storage growth (minimum `1Gi`). When this limit is reached, scaling stops
121
+
122
+
Example configuration:
123
+
124
+
```yaml
125
+
spec:
126
+
storageScaling:
127
+
enableVolumeScaling: true
128
+
autoscaling:
129
+
enabled: true
130
+
triggerThresholdPercent: 80
131
+
growthStep: 2Gi
132
+
maxSize: 10Gi
133
+
```
134
+
135
+
3. Apply the configuration:
136
+
137
+
```bash
138
+
kubectl apply -f deploy/cr.yaml -n <namespace>
139
+
```
140
+
141
+
When the Operator changes the storage size, it updates the Custom Resource status as follows:
142
+
143
+
* adds the `pvc-resize-in-progress` annotation. The annotation contains the timestamp of the resize start and indicates that the resize operation is running. After the resize finishes, the Operator deletes this annotation
144
+
* records the new size in the `currentSize` field
145
+
* updates the `resizeCount` field
146
+
* records any errors in the `lastError` field
147
+
148
+
Run `kubectl get ps <cluster-name> -o yaml -n <namespace>` to check the current cluster state.
149
+
150
+
??? example "Sample output"
151
+
152
+
```{.text .no-copy}
153
+
storageAutoscaling:
154
+
datadir-ps-cluster1-mysql-0:
155
+
currentSize: 4194304Ki
156
+
lastResizeTime: "2026-01-23T15:08:59Z"
157
+
resizeCount: 2
158
+
```
159
+
160
+
The `storageAutoscaling` section appears under the `.status` in the Custom Resource.
161
+
162
+
When the storage size reaches the limit, no further resizing is done and this event is recorded in the logs. You can either clean up the data or set a new limit based on your organization's policies and requirements. For help with common issues, see [Operator logs](debug-logs.md).
163
+
74
164
#### Storage resizing with Volume Expansion capability
75
165
76
166
In this document we're using the default Percona Server for MySQL cluster name `ps-cluster1`. If you have a different name, replace `ps-cluster1` with it in the commands.
77
167
78
168
To enable storage resizing via volume expansion, do the following:
79
169
80
-
1. Set the [enableVolumeExpansion](operator.md#enablevolumeexpansion) Custom Resource option to `true` (it is turned off by default). When enabled, the Operator will automatically expand the storage for you when you define a new size in the Custom Resource
170
+
1. Set the [`storageScaling.enableVolumeScaling`](operator.md#storagescalingenablevolumescaling) Custom Resource option to `true` (it is turned off by default). When enabled, the Operator automatically expands storage when you increase the size in the Custom Resource
81
171
2. Change the
82
172
`mysql.volumeSpec.persistentVolumeClaim.resources.requests.storage`option in the `deploy/cr.yaml` file to the desired storage size.
83
173
@@ -86,8 +176,8 @@ To enable storage resizing via volume expansion, do the following:
86
176
```yaml
87
177
spec:
88
178
...
89
-
enableVolumeExpansion: true
90
-
...
179
+
storageScaling:
180
+
enableVolumeScaling: true
91
181
mysql:
92
182
...
93
183
volumeSpec:
@@ -100,8 +190,8 @@ To enable storage resizing via volume expansion, do the following:
100
190
101
191
3. Apply the new configuration:
102
192
103
-
```{.bash data-prompt="$" }
104
-
$ kubectl apply -f cr.yaml
193
+
```
194
+
kubectl apply -f cr.yaml
105
195
```
106
196
107
197
The storage size change takes some time. When it starts, the Operator automatically adds the `pvc-resize-in-progress` annotation to the `PerconaServerMySQL` Custom Resource. The annotation contains the timestamp of the resize start and indicates that the resize operation is running. After the resize finishes, the Operator deletes this annotation.
0 commit comments