KubeBlocks
BlogsEnterprise
⌘K
​
Blogs

Overview
Quickstart
Architecture

Operations

Lifecycle Management
Vertical Scaling
Horizontal Scaling
Volume Expansion
Configuration
Minor Version Upgrade
Manage Services

Backup And Restore

Backup
Restore

Monitoring

Observability for ZooKeeper Clusters
FAQs
  1. Prerequisites
  2. Vertical Scale
  3. Verify
  4. Best Practices
  5. Cleanup

Vertical Scaling for ZooKeeper Clusters with KubeBlocks

This guide demonstrates how to vertically scale a ZooKeeper cluster managed by KubeBlocks by adjusting compute resources (CPU and memory).

Vertical scaling modifies compute resources (CPU and memory) for ZooKeeper instances while maintaining replica count. Key characteristics:

  • Non-disruptive: Maintains ensemble availability during scaling
  • Granular: Adjust CPU, memory, or both independently
  • Reversible: Scale up or down as needed

KubeBlocks orchestrates scaling with minimal impact — followers are updated first, then the leader.

Prerequisites

    Before proceeding, verify your environment meets these requirements:

    • A functional Kubernetes cluster (v1.21+ recommended)
    • kubectl v1.21+ installed and configured with cluster access
    • Helm installed (installation guide)
    • KubeBlocks installed (installation guide)
    • ZooKeeper Add-on installed and a ZooKeeper cluster running (see Quickstart)

    Vertical Scale

    Apply the following YAML to scale up the resources for the zookeeper component:

    apiVersion: operations.kubeblocks.io/v1alpha1 kind: OpsRequest metadata: name: zookeeper-verticalscaling namespace: demo spec: clusterName: zookeeper-cluster type: VerticalScaling verticalScaling: - componentName: zookeeper requests: cpu: '1' memory: 1Gi limits: cpu: '1' memory: 1Gi

    Apply it:

    kubectl apply -f https://raw.githubusercontent.com/apecloud/kubeblocks-addons/refs/heads/main/examples/zookeeper/verticalscale.yaml

    Monitor the progress:

    kubectl get ops zookeeper-verticalscaling -n demo -w
    Example Output
    NAME TYPE CLUSTER STATUS PROGRESS AGE zookeeper-verticalscaling VerticalScaling zookeeper-cluster Running 0/3 14s zookeeper-verticalscaling VerticalScaling zookeeper-cluster Running 1/3 69s zookeeper-verticalscaling VerticalScaling zookeeper-cluster Running 2/3 2m49s zookeeper-verticalscaling VerticalScaling zookeeper-cluster Succeed 3/3 3m55s

    Update spec.componentSpecs.resources to the desired resources:

    apiVersion: apps.kubeblocks.io/v1 kind: Cluster metadata: name: zookeeper-cluster namespace: demo spec: terminationPolicy: Delete componentSpecs: - name: zookeeper componentDef: zookeeper serviceVersion: 3.9.2 replicas: 3 resources: requests: cpu: "1" # Update as needed memory: "1Gi" # Update as needed limits: cpu: "1" # Update as needed memory: "1Gi" # Update as needed volumeClaimTemplates: - name: data spec: storageClassName: "" accessModes: - ReadWriteOnce resources: requests: storage: 20Gi - name: snapshot-log spec: storageClassName: "" accessModes: - ReadWriteOnce resources: requests: storage: 20Gi

    Verify

    After scaling, confirm the updated resources:

    kubectl get cluster zookeeper-cluster -n demo
    Example Output
    NAME CLUSTER-DEFINITION TERMINATION-POLICY STATUS AGE zookeeper-cluster Delete Running 7m
    kubectl get pods -n demo -l app.kubernetes.io/instance=zookeeper-cluster -o jsonpath='{range .items[*]}{.metadata.name}{"\t"}{.spec.containers[0].resources.limits}{"\n"}{end}'

    Best Practices

    • Scale during maintenance windows or low-traffic periods
    • Verify Kubernetes cluster has sufficient resources before scaling
    • Set identical requests/limits for guaranteed QoS
    • Monitor ZooKeeper performance metrics after scaling

    Cleanup

    kubectl delete cluster zookeeper-cluster -n demo kubectl delete ns demo

    © 2026 KUBEBLOCKS INC