From 6d2c47909f1ead3f2a11ade1b20c8957c9451183 Mon Sep 17 00:00:00 2001 From: Hiranmoy Das Chowdhury Date: Wed, 27 Nov 2024 18:37:56 +0600 Subject: [PATCH] vertical scaling done fully Signed-off-by: Hiranmoy Das Chowdhury --- .../pgbouncer/scaling/pb-vertical-ops.yaml | 20 ++++ .../pgbouncer/scaling/pb-vertical.yaml | 23 ++++ .../scaling/vertical-scaling/overview.md | 2 +- .../scaling/vertical-scaling/vertical-ops.md | 99 +++++++++-------- .../pgbouncer/vertical-scaling.svg | 104 ++++++++++++++++++ 5 files changed, 203 insertions(+), 45 deletions(-) create mode 100644 docs/examples/pgbouncer/scaling/pb-vertical-ops.yaml create mode 100644 docs/examples/pgbouncer/scaling/pb-vertical.yaml create mode 100644 docs/images/day-2-operation/pgbouncer/vertical-scaling.svg diff --git a/docs/examples/pgbouncer/scaling/pb-vertical-ops.yaml b/docs/examples/pgbouncer/scaling/pb-vertical-ops.yaml new file mode 100644 index 000000000..cf24a4b11 --- /dev/null +++ b/docs/examples/pgbouncer/scaling/pb-vertical-ops.yaml @@ -0,0 +1,20 @@ +apiVersion: ops.kubedb.com/v1alpha1 +kind: PgBouncerOpsRequest +metadata: + name: pgbouncer-scale-vertical + namespace: demo +spec: + type: VerticalScaling + databaseRef: + name: pb-vertical + verticalScaling: + pgbouncer: + resources: + requests: + memory: "2Gi" + cpu: "1" + limits: + memory: "2Gi" + cpu: "1" + timeout: 5m + apply: IfReady \ No newline at end of file diff --git a/docs/examples/pgbouncer/scaling/pb-vertical.yaml b/docs/examples/pgbouncer/scaling/pb-vertical.yaml new file mode 100644 index 000000000..97c25040b --- /dev/null +++ b/docs/examples/pgbouncer/scaling/pb-vertical.yaml @@ -0,0 +1,23 @@ +apiVersion: kubedb.com/v1 +kind: PgBouncer +metadata: + name: pb-vertical + namespace: demo +spec: + replicas: 1 + version: "1.18.0" + database: + syncUsers: true + databaseName: "postgres" + databaseRef: + name: "ha-postgres" + namespace: demo + connectionPool: + poolMode: session + port: 5432 + reservePoolSize: 5 + maxClientConnections: 87 + defaultPoolSize: 2 + minPoolSize: 1 + authType: md5 + deletionPolicy: WipeOut \ No newline at end of file diff --git a/docs/guides/pgbouncer/scaling/vertical-scaling/overview.md b/docs/guides/pgbouncer/scaling/vertical-scaling/overview.md index 5ec7f24c8..77839a614 100644 --- a/docs/guides/pgbouncer/scaling/vertical-scaling/overview.md +++ b/docs/guides/pgbouncer/scaling/vertical-scaling/overview.md @@ -27,7 +27,7 @@ This guide will give an overview on how KubeDB Ops-manager operator updates the The following diagram shows how KubeDB Ops-manager operator updates the resources of the `PgBouncer`. Open the image in a new tab to see the enlarged version.
-  Vertical scaling process of PgBouncer +  Vertical scaling process of PgBouncer
Fig: Vertical scaling process of PgBouncer
diff --git a/docs/guides/pgbouncer/scaling/vertical-scaling/vertical-ops.md b/docs/guides/pgbouncer/scaling/vertical-scaling/vertical-ops.md index 25c508356..eb3bb8da0 100644 --- a/docs/guides/pgbouncer/scaling/vertical-scaling/vertical-ops.md +++ b/docs/guides/pgbouncer/scaling/vertical-scaling/vertical-ops.md @@ -98,7 +98,6 @@ Let's check the Pod containers resources, $ kubectl get pod -n demo pb-vertical-0 -o json | jq '.spec.containers[].resources' { "limits": { - "cpu": "500m", "memory": "1Gi" }, "requests": { @@ -153,7 +152,7 @@ Here, Let's create the `PgBouncerOpsRequest` CR we have shown above, ```bash -$ kubectl apply -f https://github.com/kubedb/docs/raw/{{< param "info.version" >}}/docs/examples/pgbouncer/scaling/vertical-scaling/pb-vertical-ops.yaml +$ kubectl apply -f https://github.com/kubedb/docs/raw/{{< param "info.version" >}}/docs/examples/pgbouncer/scaling/pb-vertical-ops.yaml pgbounceropsrequest.ops.kubedb.com/pgbouncer-scale-vertical created ``` @@ -181,10 +180,10 @@ Annotations: API Version: ops.kubedb.com/v1alpha1 Kind: PgBouncerOpsRequest Metadata: - Creation Timestamp: 2024-07-17T09:44:22Z + Creation Timestamp: 2024-11-27T12:35:02Z Generation: 1 - Resource Version: 68270 - UID: 62a105f7-e7b9-444e-9303-79818fccfdef + Resource Version: 55854 + UID: 567e12f9-b561-4fea-af91-1ed9412a0d74 Spec: Apply: IfReady Database Ref: @@ -192,7 +191,7 @@ Spec: Timeout: 5m Type: VerticalScaling Vertical Scaling: - Node: + Pgbouncer: Resources: Limits: Cpu: 1 @@ -202,47 +201,51 @@ Spec: Memory: 2Gi Status: Conditions: - Last Transition Time: 2024-07-17T09:44:22Z - Message: PgBouncer ops-request has started to vertically scaling the PgBouncer nodes - Observed Generation: 1 - Reason: VerticalScaling - Status: True - Type: VerticalScaling - Last Transition Time: 2024-07-17T09:44:25Z - Message: Successfully paused database + Last Transition Time: 2024-11-27T12:35:02Z + Message: Controller has started to Progress with VerticalScaling of PgBouncerOpsRequest: demo/pgbouncer-scale-vertical Observed Generation: 1 - Reason: DatabasePauseSucceeded + Reason: Running Status: True - Type: DatabasePauseSucceeded - Last Transition Time: 2024-07-17T09:44:25Z - Message: Successfully updated PetSets Resources + Type: Running + Last Transition Time: 2024-11-27T12:35:08Z + Message: Successfully updated Petset resource Observed Generation: 1 Reason: UpdatePetSets Status: True Type: UpdatePetSets - Last Transition Time: 2024-07-17T09:45:10Z - Message: Successfully Restarted Pods With Resources - Observed Generation: 1 - Reason: RestartPods - Status: True - Type: RestartPods - Last Transition Time: 2024-07-17T09:44:30Z + Last Transition Time: 2024-11-27T12:35:13Z Message: get pod; ConditionStatus:True; PodName:pb-vertical-0 Observed Generation: 1 Status: True Type: GetPod--pb-vertical-0 - Last Transition Time: 2024-07-17T09:44:30Z + Last Transition Time: 2024-11-27T12:35:13Z Message: evict pod; ConditionStatus:True; PodName:pb-vertical-0 Observed Generation: 1 Status: True Type: EvictPod--pb-vertical-0 - Last Transition Time: 2024-07-17T09:45:05Z - Message: check pod running; ConditionStatus:True; PodName:pb-vertical-0 + Last Transition Time: 2024-11-27T12:35:18Z + Message: check replica func; ConditionStatus:True; PodName:pb-vertical-0 + Observed Generation: 1 + Status: True + Type: CheckReplicaFunc--pb-vertical-0 + Last Transition Time: 2024-11-27T12:35:18Z + Message: check pod ready; ConditionStatus:True; PodName:pb-vertical-0 + Observed Generation: 1 + Status: True + Type: CheckPodReady--pb-vertical-0 + Last Transition Time: 2024-11-27T12:35:38Z + Message: check pg bouncer running; ConditionStatus:True; PodName:pb-vertical-0 + Observed Generation: 1 + Status: True + Type: CheckPgBouncerRunning--pb-vertical-0 + Last Transition Time: 2024-11-27T12:35:43Z + Message: Vertical scaling Up performed successfully in PgBouncer: demo/pb-vertical for PgBouncerOpsRequest: pgbouncer-scale-vertical Observed Generation: 1 + Reason: VerticalScaleSucceeded Status: True - Type: CheckPodRunning--pb-vertical-0 - Last Transition Time: 2024-07-17T09:45:10Z - Message: Successfully completed the vertical scaling for PgBouncer + Type: VerticalScale + Last Transition Time: 2024-11-27T12:35:53Z + Message: Controller has successfully completed with VerticalScaling of PgBouncerOpsRequest: demo/pgbouncer-scale-vertical Observed Generation: 1 Reason: Successful Status: True @@ -250,19 +253,27 @@ Status: Observed Generation: 1 Phase: Successful Events: - Type Reason Age From Message - ---- ------ ---- ---- ------- - Normal Starting 4m16s KubeDB Ops-manager Operator Start processing for PgBouncerOpsRequest: demo/pgbouncer-scale-vertical - Normal Starting 4m16s KubeDB Ops-manager Operator Pausing PgBouncer databse: demo/pb-vertical - Normal Successful 4m16s KubeDB Ops-manager Operator Successfully paused PgBouncer database: demo/pb-vertical for PgBouncerOpsRequest: pgbouncer-scale-vertical - Normal UpdatePetSets 4m13s KubeDB Ops-manager Operator Successfully updated PetSets Resources - Warning get pod; ConditionStatus:True; PodName:pb-vertical-0 4m8s KubeDB Ops-manager Operator get pod; ConditionStatus:True; PodName:pb-vertical-0 - Warning evict pod; ConditionStatus:True; PodName:pb-vertical-0 4m8s KubeDB Ops-manager Operator evict pod; ConditionStatus:True; PodName:pb-vertical-0 - Warning check pod running; ConditionStatus:False; PodName:pb-vertical-0 4m3s KubeDB Ops-manager Operator check pod running; ConditionStatus:False; PodName:pb-vertical-0 - Warning check pod running; ConditionStatus:True; PodName:pb-vertical-0 3m33s KubeDB Ops-manager Operator check pod running; ConditionStatus:True; PodName:pb-vertical-0 - Normal RestartPods 3m28s KubeDB Ops-manager Operator Successfully Restarted Pods With Resources - Normal Starting 3m28s KubeDB Ops-manager Operator Resuming PgBouncer database: demo/pb-vertical - Normal Successful 3m28s KubeDB Ops-manager Operator Successfully resumed PgBouncer database: demo/pb-vertical for PgBouncerOpsRequest: pgbouncer-scale-vertical + Type Reason Age From Message + ---- ------ ---- ---- ------- + Normal Starting 81s KubeDB Ops-manager Operator Start processing for PgBouncerOpsRequest: demo/pgbouncer-scale-vertical + Normal Starting 81s KubeDB Ops-manager Operator Pausing PgBouncer databse: demo/pb-vertical + Normal Successful 81s KubeDB Ops-manager Operator Successfully paused PgBouncer database: demo/pb-vertical for PgBouncerOpsRequest: pgbouncer-scale-vertical + Warning get pod; ConditionStatus:True; PodName:pb-vertical-0 70s KubeDB Ops-manager Operator get pod; ConditionStatus:True; PodName:pb-vertical-0 + Warning evict pod; ConditionStatus:True; PodName:pb-vertical-0 70s KubeDB Ops-manager Operator evict pod; ConditionStatus:True; PodName:pb-vertical-0 + Warning check replica func; ConditionStatus:True; PodName:pb-vertical-0 65s KubeDB Ops-manager Operator check replica func; ConditionStatus:True; PodName:pb-vertical-0 + Warning check pod ready; ConditionStatus:True; PodName:pb-vertical-0 65s KubeDB Ops-manager Operator check pod ready; ConditionStatus:True; PodName:pb-vertical-0 + Warning check pg bouncer running; ConditionStatus:False; PodName:pb-vertical-0 55s KubeDB Ops-manager Operator check pg bouncer running; ConditionStatus:False; PodName:pb-vertical-0 + Warning check replica func; ConditionStatus:True; PodName:pb-vertical-0 55s KubeDB Ops-manager Operator check replica func; ConditionStatus:True; PodName:pb-vertical-0 + Warning check pod ready; ConditionStatus:True; PodName:pb-vertical-0 55s KubeDB Ops-manager Operator check pod ready; ConditionStatus:True; PodName:pb-vertical-0 + Warning check replica func; ConditionStatus:True; PodName:pb-vertical-0 45s KubeDB Ops-manager Operator check replica func; ConditionStatus:True; PodName:pb-vertical-0 + Warning check pod ready; ConditionStatus:True; PodName:pb-vertical-0 45s KubeDB Ops-manager Operator check pod ready; ConditionStatus:True; PodName:pb-vertical-0 + Warning check pg bouncer running; ConditionStatus:True; PodName:pb-vertical-0 45s KubeDB Ops-manager Operator check pg bouncer running; ConditionStatus:True; PodName:pb-vertical-0 + Normal Successful 40s KubeDB Ops-manager Operator Vertical scaling Up performed successfully in PgBouncer: demo/pb-vertical for PgBouncerOpsRequest: pgbouncer-scale-vertical + Normal Starting 30s KubeDB Ops-manager Operator Resuming PgBouncer database: demo/pb-vertical + Normal Successful 30s KubeDB Ops-manager Operator Successfully resumed PgBouncer database: demo/pb-vertical + Normal Starting 30s KubeDB Ops-manager Operator Resuming PgBouncer database: demo/pb-vertical + Normal Successful 30s KubeDB Ops-manager Operator Successfully resumed PgBouncer database: demo/pb-vertical + Normal Successful 30s KubeDB Ops-manager Operator Controller has Successfully scaled the PgBouncer database: demo/pb-vertical ``` Now, we are going to verify from the Pod yaml whether the resources of the pgbouncer has updated to meet up the desired state, Let's check, diff --git a/docs/images/day-2-operation/pgbouncer/vertical-scaling.svg b/docs/images/day-2-operation/pgbouncer/vertical-scaling.svg new file mode 100644 index 000000000..e8effa6bd --- /dev/null +++ b/docs/images/day-2-operation/pgbouncer/vertical-scaling.svg @@ -0,0 +1,104 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +