milvus-logo
LFAI
Home
  • Administration Guide

Configure Milvus with Milvus Operator

In production environment, you need to allocate resources to the Milvus cluster based on machine type and workload. You can configure during deployment or update the configurations while the cluster is running.

This topic introduces how to configure a Milvus cluster when you install it with Milvus Operator.

This topic assumes that you have deployed Milvus Operator. See Deploy Milvus Operator for more information.

Configuring a Milvus cluster with Milvus Operator includes:

  • Global resource configurations
  • Private resource configurations
Private resource configurations will overwrite global resource configurations. If you configure the resources globally and specify the private resource of a certain component at the same time, the component will prioritize and respond to the private configurations first.

Configure global resources

When using Milvus Operator to start a Milvus cluster, you need to specify a configuration file. The example here uses the default configuration file.

kubectl apply -f https://raw.githubusercontent.com/zilliztech/milvus-operator/main/config/samples/milvus_cluster_default.yaml

The details of the configuration file is as follows:

apiVersion: milvus.io/v1beta1
kind: Milvus
metadata:
  name: my-release
  labels:
    app: milvus
spec:
  mode: cluster
  dependencies: {}
  components: {}
  config: {}

The field spec.components includes both the global and private resource configuration of all Milvus components. The following are four commonly used fields to configure global resource.

  • image: The Milvus docker image used.
  • resources: The compute resources allocated to each component.
  • tolerations and nodeSelector: The scheduling rules of each Milvus component in the K8s cluster. See tolerations and nodeSelector for more information.
  • env: The environment variables.

If you want to configure more fields, see documentation here.

To configure global resource for Milvus cluster, create a milvuscluster_resource.yaml file.

Example

The following example configures global resource for a Milvus cluster.

apiVersion: milvus.io/v1beta1
kind: Milvus
metadata:
  name: my-release
  labels:
    app: milvus
spec:
  mode: cluster
  components:
    image: milvusdb/milvus:v2.1.0
    nodeSelector: {}
    tolerations: {}
    env: {}
    resources:
      limits:
        cpu: '4'
        memory: 8Gi
      requests:
        cpu: 200m
        memory: 512Mi

Run the following command to apply new configurations:

kubectl apply -f milvuscluster_resource.yaml
Cluster resources will be updated according to the configuration file if there is a Milvus cluster named my-release in the K8s cluster. Otherwise, a new Milvus cluster will be created.

Configure private resources

Originally in Milvus 2.0, a Milvus cluster includes eight components: proxy, root coord, index coord, data coord, query coord, index node, data node, and query node. However, a new component, mix coord, is released along with Milvus 2.1.0. Mix coord includes all coordinator components. Therefore, starting a mix coord means that you do not need to install and start other coordinators including root coord, index coord, data coord, and query coord.

Common fields used to configure each component include:

  • replica: The number of replicas of each component.
  • port: The listen port number of each component.
  • The four commonly used fields in global resource configuration: image, env, nodeSelector, tolerations, resources (see above). For more configurable fields, click on each component in this documentation.
In addition, when configuring proxy, there is an extra field called `serviceType`. This field defines the type of service Milvus provides in the K8s cluster.

To configure resources for a specific component, add the component name in the field under spec.componets first and then configure its private resources.

Purpose Parameters
Performance tuning
Data and meta
Administration
Quota and Limits

Example

The example below configures the replicas and compute resources of proxy and datanode in the milvuscluster.yaml file.

apiVersion: milvus.io/v1beta1
kind: Milvus
metadata:
  name: my-release
  labels:
    app: milvus
spec:
  mode: cluster
  components:
    image: milvusdb/milvus:v2.1.0
    resources:
      limits:
        cpu: '4'
        memory: 8Gi
      requests:
        cpu: 200m
        memory: 512Mi
    rootCoord: 
      replicas: 1
      port: 8080
      resources:
        limits:
          cpu: '6'
          memory: '10Gi'
    dataCoord: {}
    queryCoord: {}
    indexCoord: {}
    dataNode: {}
    indexNode: {}
    queryNode: {}
    proxy:
      replicas: 1
      serviceType: ClusterIP
      resources:
        limits:
          cpu: '2'
          memory: 4Gi
        requests:
          cpu: 100m
          memory: 128Mi
  config: {}
  dependencies: {}
This example configures not only global resources but also private compute resources for root coord and proxy. When using this configuration file to start a Milvus cluster, the private resources configurations will be applied to root coord and proxy, while the rest of the components will follow the global resource configuration.

Run the following command to apply new configurations:

kubectl apply -f milvuscluster.yaml

What’s next

Try Managed Milvus for Free

Zilliz Cloud is hassle-free, powered by Milvus and 10x faster.

Get Started
Feedback

Was this page helpful?