Allocate Resources on Kubernetes
This topic describes how to allocate resources to a Milvus cluster on Kubernetes.
Generally, the resources you allocate to a Milvus cluster in production should be proportionate to the machine workload. You should also consider the machine type when allocating resources. Although you can update the configurations when the cluster is running, we recommend setting the values before deploying the cluster.
1. View available resources
Run kubectl describe nodes
to view the available resources on the instances that you have provisioned.
2. Allocate resources
Use Helm to allocate CPU and memory resources to Milvus components.
There are two ways to allocate resources:
Allocate resources with commands
You need to set the resource variables for each Milvus component if you use --set
to update the resource configurations.
helm upgrade my-release milvus/milvus --reuse-values --set standalone.resources.limits.cpu=2 --set standalone.resources.limits.memory=4Gi --set standalone.resources.requests.cpu=0.1 --set standalone.resources.requests.memory=128Mi
helm upgrade my-release milvus/milvus --reuse-values --set dataNode.resources.limits.cpu=2 --set dataNode.resources.limits.memory=4Gi --set dataNode.resources.requests.cpu=0.1 --set dataNode.resources.requests.memory=128Mi
Allocate resources by setting configuration file
You can also allocate CPU and memory resources by specifying the parameters resources.requests
and resources.limits
in the resources.yaml
file.
dataNode:
resources:
limits:
cpu: "4"
memory: "16Gi"
requests:
cpu: "1"
memory: "4Gi"
queryNode:
resources:
limits:
cpu: "4"
memory: "16Gi"
requests:
cpu: "1"
memory: "4Gi"
3. Apply configurations
Run the following command to apply the new configurations to your Milvus cluster.
helm upgrade my-release milvus/milvus --reuse-values -f resources.yaml
resources.limits
is not specified, the pods will consume all the CPU and memory resources available. Therefore, ensure to specify resources.requests
and resources.limits
to avoid overallocation of resources when other running tasks on the same instance require more memory consumption.
See Kubernetes documentation for more information about managing resources.
What’s next
- You might also want to learn how to:
- If you are ready to deploy your cluster on clouds:
- Learn how to Deploy Milvus on AWS with Terraform and Ansible
- Learn how to Deploy Milvus on Amazon EKS with Terraform
- Learn how to Deploy Milvus Cluster on GCP with Kubernetes
- Learn how to Deploy Milvus on Microsoft Azure With Kubernetes