This guide demonstrates how to vertically scale a Milvus Cluster managed by KubeBlocks by adjusting compute resources (CPU and memory) while maintaining the same number of replicas.
Vertical scaling modifies compute resources (CPU and memory) for Milvus instances while maintaining replica count. Key characteristics:
KubeBlocks ensures minimal impact during scaling operations by following a controlled, role-aware update strategy: Role-Aware Replicas (Primary/Secondary Replicas)
Role-Unaware Replicas (Ordinal-Based Scaling) If replicas have no defined roles, updates follow Kubernetes pod ordinal order:
Before proceeding, ensure the following:
kubectl create ns demo
namespace/demo created
Please refer to Deploying a Milvus Cluster with KubeBlocks to deploy a milvus cluster.
Expected Workflow:
Updating
to Running
Check Components
There are five components in Milvus Cluster. To get the list of components,
kubectl get cluster -n demo milvus-cluster -oyaml | yq '.spec.componentSpecs[].name'
Expected Output:
proxy
mixcoord
datanode
indexnode
querynode
Option 1: Using VerticalScaling OpsRequest
Apply the following YAML to scale up the resources for the querynode component:
apiVersion: operations.kubeblocks.io/v1alpha1
kind: OpsRequest
metadata:
name: milvus-cluster-vscale-ops
namespace: demo
spec:
clusterName: milvus-cluster
type: VerticalScaling
verticalScaling:
- componentName: querynode
requests:
cpu: '1'
memory: 1Gi
limits:
cpu: '1'
memory: 1Gi
You can check the progress of the scaling operation with the following command:
kubectl -n demo get ops milvus-cluster-vscale-ops -w
Expected Result:
NAME TYPE CLUSTER STATUS PROGRESS AGE
milvus-cluster-vscale-ops VerticalScaling milvus-cluster Running 0/2 33s
milvus-cluster-vscale-ops VerticalScaling milvus-cluster Running 1/2 55s
milvus-cluster-vscale-ops VerticalScaling milvus-cluster Running 2/2 88s
Option 2: Direct Cluster API Update
Alternatively, you may update spec.componentSpecs.resources
field to the desired resources for vertical scale.
apiVersion: apps.kubeblocks.io/v1
kind: Cluster
spec:
componentSpecs:
- name: querynode
replicas: 1
resources:
requests:
cpu: "1" # Update the resources to your need.
memory: "1Gi" # Update the resources to your need.
limits:
cpu: "1" # Update the resources to your need.
memory: "1Gi" # Update the resources to your need.
...
Milvus Cluster consists of five components. This tutorial shows how to perform changes to one component. You may perform changes to other components in the same way.
Planning:
Execution:
Post-Scaling:
Verify the updated resources by inspecting the cluster configuration or Pod details:
kbcli cluster describe milvus-cluster -n demo
Expected Output:
Resources Allocation:
COMPONENT INSTANCE-TEMPLATE CPU(REQUEST/LIMIT) MEMORY(REQUEST/LIMIT) STORAGE-SIZE STORAGE-CLASS
milvus 1 / 1 1Gi / 1Gi data:20Gi <none>
To remove all created resources, delete the Milvus Cluster along with its namespace:
kubectl delete cluster milvus-cluster -n demo
kubectl delete ns demo
In this guide, you learned how to:
Vertical scaling is a powerful tool for optimizing resource utilization and adapting to changing workload demands, ensuring your Milvus Cluster remains performant and resilient.