From 4d20a3810697042f34db3e2ad671f8296f23c646 Mon Sep 17 00:00:00 2001 From: erthalion <9erthalion6@gmail.com> Date: Tue, 5 Jun 2018 11:42:01 +0200 Subject: [PATCH 1/3] Add section about volume increase --- docs/user.md | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/docs/user.md b/docs/user.md index d0ebcc1b0..7647ef71f 100644 --- a/docs/user.md +++ b/docs/user.md @@ -242,3 +242,34 @@ metadata: Note that timezone required for `timestamp` (offset relative to UTC, see RFC 3339 section 5.6) + +## Increase volume size + +PostgreSQL operator supports statefulset volume resize if you're using the +operator on top of AWS. For that you need to apply manifest with a new size, +and the operator will find out that a volume size needs to be changed: + +``` +apiVersion: "acid.zalan.do/v1" +kind: postgresql + +metadata: + name: acid-test-cluster +spec: + volume: + size: 5Gi # new volume size +``` + +You can only increase a volume size in this way, if a new requested size is +smaller than the previous one nothing will be done. After this update all the +new pods in a statefulset will be created with a new volume size. To increase a +volume size on already existing pods in a statefulset, the operator will +perform the following steps: + +* modify EBS volume size + +* resize an actuall filesystem use `resize2fs` + +Note that if before a volume size was increased a statefulset was scaled down +and (after the change was applied) scaled back, those pods that were down will +have an old volume size, since a statefulset doesn't delete volumes. From dab6c01cc7dedd1248652d9ddd1e074cf2b82607 Mon Sep 17 00:00:00 2001 From: erthalion <9erthalion6@gmail.com> Date: Wed, 6 Jun 2018 17:36:21 +0200 Subject: [PATCH 2/3] Change and clarify wording --- docs/user.md | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/docs/user.md b/docs/user.md index 7647ef71f..360b58e97 100644 --- a/docs/user.md +++ b/docs/user.md @@ -246,8 +246,8 @@ Note that timezone required for `timestamp` (offset relative to UTC, see RFC ## Increase volume size PostgreSQL operator supports statefulset volume resize if you're using the -operator on top of AWS. For that you need to apply manifest with a new size, -and the operator will find out that a volume size needs to be changed: +operator on top of AWS. For that you need to change the size field of the +volume description in the cluster manifest and apply it: ``` apiVersion: "acid.zalan.do/v1" @@ -260,16 +260,22 @@ spec: size: 5Gi # new volume size ``` -You can only increase a volume size in this way, if a new requested size is -smaller than the previous one nothing will be done. After this update all the -new pods in a statefulset will be created with a new volume size. To increase a -volume size on already existing pods in a statefulset, the operator will -perform the following steps: +The operator compares the new value of the size field with the previous one and +acts on differences. -* modify EBS volume size +You can only enlarge the volume with the process described above, shrinking is +not supported and will emit a warning. After this update all the new volumes in +a statefulset are allocated according to the new size. To enlarge persistent +volumes attached to the running pods, the operator performs the following +actions: -* resize an actuall filesystem use `resize2fs` +* call AWS API to change the volume size -Note that if before a volume size was increased a statefulset was scaled down -and (after the change was applied) scaled back, those pods that were down will -have an old volume size, since a statefulset doesn't delete volumes. +* connect to the pod using `kubectl exec` and resize the filesystem with + `resize2fs`. + +Fist step has a limitation, AWS rate-limits this operation to no more than once +every 6 hours. +Note that if the statefulset is scaled down before resizing the size changes +are only applied to the volumes attached to the running pods. The size of the +volumes that correspond to the previously running pods is not changed. From df40cd831d4e0b63be48e0f0136bab19a62e55e9 Mon Sep 17 00:00:00 2001 From: erthalion <9erthalion6@gmail.com> Date: Thu, 7 Jun 2018 10:25:50 +0200 Subject: [PATCH 3/3] Adjust the wording --- docs/user.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/user.md b/docs/user.md index 360b58e97..2420a2681 100644 --- a/docs/user.md +++ b/docs/user.md @@ -247,7 +247,7 @@ Note that timezone required for `timestamp` (offset relative to UTC, see RFC PostgreSQL operator supports statefulset volume resize if you're using the operator on top of AWS. For that you need to change the size field of the -volume description in the cluster manifest and apply it: +volume description in the cluster manifest and apply the change: ``` apiVersion: "acid.zalan.do/v1" @@ -265,7 +265,7 @@ acts on differences. You can only enlarge the volume with the process described above, shrinking is not supported and will emit a warning. After this update all the new volumes in -a statefulset are allocated according to the new size. To enlarge persistent +the statefulset are allocated according to the new size. To enlarge persistent volumes attached to the running pods, the operator performs the following actions: