Skip to content

Commit 1497633

Browse files
Merge pull request #209545 from MikeRayMSFT/20220829-resize-pvc
Resize PVC for Arc-enabled data services.
2 parents 424d340 + f07a6c7 commit 1497633

File tree

2 files changed

+114
-0
lines changed

2 files changed

+114
-0
lines changed
Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
---
2+
title: Resize persistent volume claim (PVC) for Azure Arc-enabled data services volume
3+
description: Explains how to resize a persistent volume claim for a volume used for Azure Arc-enabled data services.
4+
services: azure-arc
5+
ms.service: azure-arc
6+
ms.subservice: azure-arc-data-sqlmi
7+
author: dnethi
8+
ms.author: dinethi
9+
ms.reviewer: mikeray
10+
ms.date: 08/29/2022
11+
ms.topic: how-to
12+
---
13+
14+
# Resize persistent volume to increase size
15+
16+
This article explains how to resize an existing persistent volume to increase its size by editing the `PersistentVolumeClaim` (PVC) object.
17+
18+
> [!NOTE]
19+
> Resizing PVCs using this method only works your `StorageClass` supports `AllowVolumeExpansion=True`.
20+
21+
When you deploy an Azure Arc enabled SQL managed instance, you can configure the size of the persistent volume (PV) for `data`, `logs`, `datalogs`, and `backups`. The deployment creates these volumes based on the values set by parameters `--volume-size-data`, `--volume-size-logs`, `--volume-size-datalogs`, and `--volume-size-backups`. When these volumes become full, you will need to resize the `PersistentVolumes`. Azure Arc enabled SQL Managed Instance is deployed as part of a `StatefulSet` for both General Purpose or Business Critical service tiers. Kubernetes supports automatic resizing for persistent volumes but not for volumes attached to `StatefulSet`.
22+
23+
Following are the steps to resize persistent volumes attached to `StatefulSet`:
24+
25+
1. Scale the `StatefulSet` replicas to 0
26+
2. Patch the PVC to the new size
27+
3. Scale the `StatefulSet` replicas back to the original size
28+
29+
During the patching of `PersistentVolumeClaim`, the status of the persistent volume claim will likely change from: `Attached` to `Resizing` to `FileSystemResizePending` to `Attached`. The exact states will depend on the storage provisioner.
30+
31+
> [!NOTE]
32+
> Ensure the managed instance is in a healthy state before you proceed. Run `kubectl get sqlmi -n <namespace>` and check the status of the managed instance.
33+
34+
## 1. Scale the `StatefulSet` replicas to 0
35+
36+
There is one `StatefulSet` deployed for each Arc SQL MI. The number of replicas in the `StatefulSet` is equal to the number of replicas in the Arc SQL MI. For General Purpose service tier, this is 1. For Business Critical service tier it could be 1, 2 or 3 depending on how many replicas were specified. Run the below command to get the number of `StatefulSet` replicas if you have a Business Critical instance.
37+
38+
```console
39+
kubectl get sts --namespace <namespace>
40+
```
41+
42+
For example, if the namespace is `arc`, run:
43+
44+
```console
45+
kubectl get sts --namespace arc
46+
```
47+
48+
Notice the number of stateful sets under the `READY` column for the SQL managed instance(s).
49+
50+
Run the below command to scale the `StatefulSet` replicas to 0:
51+
52+
```console
53+
kubectl scale statefulsets <statefulset> --namespace <namespace> --replicas= <number>
54+
```
55+
56+
For example:
57+
58+
```console
59+
kubectl scale statefulsets sqlmi1 --namespace arc --replicas=0
60+
```
61+
62+
## 2. Patch the PVC to the new size
63+
64+
Run the below command to get the name of the `PersistentVolumeClaim` which needs to be resized:
65+
66+
```console
67+
kubectl get pvc --namespace <namespace>
68+
```
69+
70+
For example:
71+
72+
```console
73+
kubectl get pvc --namespace arc
74+
```
75+
76+
77+
Once the stateful `StatefulSet` replicas have completed scaling down to 0, patch the `StatefulSet`. Run the following command:
78+
79+
```console
80+
$newsize='{\"spec\":{\"resources\":{\"requests\":{\"storage\":\"<newsize>Gi\"}}}}'
81+
kubectl patch pvc <name of PVC> --namespace <namespace> --type merge --patch $newsize
82+
```
83+
84+
For example: the following command will resize the data PVC to 50Gi.
85+
86+
```console
87+
$newsize='{\"spec\":{\"resources\":{\"requests\":{\"storage\":\"50Gi\"}}}}'
88+
kubectl patch pvc data-a6gt3be7mrtq60eao0gmgxgd-sqlmi1-0 --namespace arcns --type merge --patch $newsize
89+
```
90+
91+
## 3. Scale the `StatefulSet` replicas to original size
92+
93+
Once the resize completes, scale the `StatefulSet` replicas back to its original size by running the below command:
94+
95+
```console
96+
kubectl scale statefulsets <statefulset> --namespace <namespace> --replicas= <number>
97+
```
98+
99+
For example: The below command sets the `StatefulSet` replicas to 3.
100+
101+
```
102+
kubectl scale statefulsets sqlmi1 --namespace arc --replicas=3
103+
```
104+
Ensure the Arc enabled SQL managed instance is back to ready status by running:
105+
106+
```console
107+
kubectl get sqlmi -A
108+
```
109+
110+
## See also
111+
112+
[Sizing Guidance](sizing-guidance.md)

articles/azure-arc/data/toc.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,8 @@ items:
150150
href: reserved-capacity-overview.md
151151
- name: Rotate certificates
152152
href: rotate-user-tls-certificate.md
153+
- name: Resize persistent volume (PVC)
154+
href: resize-persistent-volume-claim.md
153155
- name: Delete
154156
href: delete-managed-instance.md
155157
- name: Upgrade

0 commit comments

Comments
 (0)