milvus
by apecloud
A cloud-native vector database, storage for next generation AI applications.
About this chart
Milvus
Milvus is an open source (Apache-2.0 licensed) vector database built to power embedding similarity search and AI applications. Milvus's architecture is designed to handle large-scale vector datasets and includes various deployment modes: Milvus Standalone, and Milvus Distributed, to accommodate different data scale needs.
-
Standalone Mode, including three components:
- Milvus: Provides the core functionality of the system.
- Metadata Storage (ETCD): A metadata engine for accessing and storing metadata of Milvus internal components (including proxies, index nodes, etc.), typically using etcd.
- Object Storage (minio): A storage engine responsible for the persistence of Milvus data, typically using MinIO or S3-compatible storage services.
-
Cluster Mode, including multiple layers:
- Access Layer: composed of a group of stateless proxies
- Worker Nodes:
- Query Nodes
- Data Nodes
- Index Nodes
- Coordinator Service: Manages the metadata of the cluster, including Root, Query , Data, and Index Coordinators.
- Storage Layer, including
- Metadata Storage (ETCD): A metadata engine for accessing and storing metadata of Milvus internal components, typically using etcd.
- Object Storage (minio): A storage engine responsible for the persistence of Milvus data, typically using MinIO or S3-compatible storage services.
- Log Storage (Pulsar): A log storage engine responsible for the persistence of Milvus logs, typically using Apache Pulsar.
Features In KubeBlocks
Lifecycle Management
| Topology | Horizontalscaling | Vertical scaling | Expandvolume | Restart | Stop/Start | Configure | Expose | Switchover |
|---|---|---|---|---|---|---|---|---|
| Standalone/Cluster | Yes | Yes | N/A | Yes | Yes | N/A | Yes | N/A |
Backup and Restore
| Feature | Method | Description |
|---|---|---|
| N/A | N/A | N/A |
Versions
| Versions |
|---|
| 2.3.2 |
Prerequisites
-
Kubernetes cluster >= v1.21
-
kubectlinstalled, refer to K8s Install Tools -
Helm, refer to Installing Helm
-
KubeBlocks installed and running, refer to Install Kubeblocks
-
ETCD , Milvus , Pulsar Addons Enabled, refer to Install Addons
-
Create K8s Namespace
demo, to keep resources created in this tutorial isolated:kubectl create ns demo
Examples
Create
Standalone Mode
Create a Milvus cluster of Standalone mode:
# cat examples/milvus/cluster-standalone.yaml
apiVersion: apps.kubeblocks.io/v1
kind: Cluster
metadata:
name: milvus-standalone
namespace: demo
spec:
# Specifies the behavior when a Cluster is deleted.
# Valid options are: [DoNotTerminate, Delete, WipeOut] (`Halt` is deprecated since KB 0.9)
# - `DoNotTerminate`: Prevents deletion of the Cluster. This policy ensures that all resources remain intact.
# - `Delete`: Extends the `Halt` policy by also removing PVCs, leading to a thorough cleanup while removing all persistent data.
# - `WipeOut`: An aggressive policy that deletes all Cluster resources, including volume snapshots and backups in external storage. This results in complete data removal and should be used cautiously, primarily in non-production environments to avoid irreversible data loss.
terminationPolicy: Delete
# Specifies the name of the ClusterDefinition to use when creating a Cluster.
# Note: DO NOT UPDATE THIS FIELD
# The value must be `milvus` to create a Milvus Cluster
clusterDef: milvus
# Specifies the name of the ClusterTopology to be used when creating the
# Cluster.
# Valid options are: [standalone,cluster]
topology: standalone
# Specifies a list of ClusterComponentSpec objects used to define the
# individual Components that make up a Cluster.
# This field allows for detailed configuration of each Component within the Cluster
componentSpecs:
- name: etcd
replicas: 1
resources:
limits:
cpu: "0.5"
memory: "0.5Gi"
requests:
cpu: "0.5"
memory: "0.5Gi"
volumeClaimTemplates:
- name: data
spec:
storageClassName: ""
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 10Gi
- name: minio
replicas: 1
resources:
limits:
cpu: "0.5"
memory: "0.5Gi"
requests:
cpu: "0.5"
memory: "0.5Gi"
volumeClaimTemplates:
- name: data
spec:
storageClassName: ""
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 10Gi
- name: milvus
replicas: 1
resources:
limits:
cpu: "0.5"
memory: "0.5Gi"
requests:
cpu: "0.5"
memory: "0.5Gi"
volumeClaimTemplates:
- name: data
spec:
storageClassName: ""
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 10Gi
kubectl apply -f examples/milvus/cluster-standalone.yaml
This will create a standalone Milvus cluster with the following components: Milvus, Metadata Storage (ETCD), Object Storage (minio), and Milvus will not be created until the ETCD and Minio are ready.
To access the Milvus service, you can expose the service by creating a service:
kubectl port-forward pod/milvus-standalone-milvus-0 -n demo 19530:19530
And then you can access the Milvus service via localhost:19530. For instance you can run the python code below to test the service:
Cluster Mode
TO create a Milvus cluster of Cluster mode, it is recommended to create one etcd cluster and one minio cluster before hand for Storage.
# cat examples/milvus/etcd-cluster.yaml
apiVersion: apps.kubeblocks.io/v1
kind: Cluster
metadata:
name: etcdm-cluster
namespace: demo
spec:
terminationPolicy: WipeOut
componentSpecs:
- name: etcd
componentDef: etcd-3
serviceVersion: 3.5.6
replicas: 1
resources:
limits:
cpu: '0.5'
memory: 0.5Gi
requests:
cpu: '0.5'
memory: 0.5Gi
volumeClaimTemplates:
- name: data
spec:
storageClassName: ""
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 20Gi
kubectl apply -f examples/milvus/etcd-cluster.yaml # for metadata storage
kubectl apply -f examples/milvus/minio-cluster.yaml # for object storage
kubectl apply -f examples/milvus/pulsar-cluster.yaml # for log storage
Create a Milvus cluster with Cluster mode:
# cat examples/milvus/cluster.yaml
apiVersion: apps.kubeblocks.io/v1
kind: Cluster
metadata:
namespace: demo
name: milvus-cluster
spec:
# Specifies the behavior when a Cluster is deleted.
# Valid options are: [DoNotTerminate, Delete, WipeOut] (`Halt` is deprecated since KB 0.9)
# - `DoNotTerminate`: Prevents deletion of the Cluster. This policy ensures that all resources remain intact.
# - `Delete`: Extends the `Halt` policy by also removing PVCs, leading to a thorough cleanup while removing all persistent data.
# - `WipeOut`: An aggressive policy that deletes all Cluster resources, including volume snapshots and backups in external storage. This results in complete data removal and should be used cautiously, primarily in non-production environments to avoid irreversible data loss.
terminationPolicy: Delete
# Specifies the name of the ClusterDefinition to use when creating a Cluster.
# Note: DO NOT UPDATE THIS FIELD
# The value must be `milvus` to create a Milvus Cluster
clusterDef: milvus
# Specifies the name of the ClusterTopology to be used when creating the
# Cluster.
# Valid options are: [standalone,cluster]
topology: cluster
# Specifies a list of ClusterComponentSpec objects used to define the
# individual Components that make up a Cluster.
# This field allows for detailed configuration of each Component within the Cluster
componentSpecs:
- name: proxy
replicas: 1
resources:
limits:
cpu: "0.5"
memory: "0.5Gi"
requests:
cpu: "0.5"
memory: "0.5Gi"
configs:
- name: config
variables:
mq_type: pulsar
minio_bucket: milvus
minio_root_path: files
minio_use_path_style: "true"
# Defines a list of ServiceRef for a Component
serviceRefs:
- name: milvus-meta-storage # Specifies the identifier of the service reference declaration, defined in `componentDefinition.spec.serviceRefDeclarations[*].name`
namespace: demo # namepspace of referee cluster, update on demand
# References a service provided by another KubeBlocks Cluster
clusterServiceSelector:
cluster: etcdm-cluster # ETCD Cluster Name, update the cluster name on demand
service:
component: etcd # component name, should be etcd
service: headless # Refer to default headless Service
port: client # Refer to port name 'client'
- name: milvus-log-storage
namespace: demo
clusterServiceSelector:
cluster: pulsarm-cluster # Pulsar Cluster Name
service:
component: broker
service: headless
port: pulsar
- name: milvus-object-storage
namespace: demo
clusterServiceSelector:
cluster: miniom-cluster # Minio Cluster Name
service:
component: minio
service: headless
port: api
credential: # Specifies the SystemAccount to authenticate and establish a connection with the referenced Cluster.
component: minio # for component 'minio'
name: root # the name of the credential (SystemAccount) to reference, using account 'root' in this case
- name: mixcoord
replicas: 1
resources:
limits:
cpu: "0.5"
memory: "0.5Gi"
requests:
cpu: "0.5"
memory: "0.5Gi"
serviceRefs:
- name: milvus-meta-storage
namespace: demo
clusterServiceSelector:
cluster: etcdm-cluster
service:
component: etcd
service: headless
port: client
- name: milvus-log-storage
namespace: demo
clusterServiceSelector:
cluster: pulsarm-cluster
service:
component: broker
service: headless
port: pulsar
- name: milvus-object-storage
namespace: demo
clusterServiceSelector:
cluster: miniom-cluster
service:
component: minio
service: headless
port: api
credential:
component: minio
name: root
configs:
- name: config
variables:
mq_type: pulsar
minio_bucket: milvus
minio_root_path: files
minio_use_path_style: "true"
- name: datanode
replicas: 1
resources:
limits:
cpu: "0.5"
memory: "0.5Gi"
requests:
cpu: "0.5"
memory: "0.5Gi"
serviceRefs:
- name: milvus-meta-storage
namespace: demo
clusterServiceSelector:
cluster: etcdm-cluster
service:
component: etcd
service: headless
port: client
- name: milvus-log-storage
namespace: demo
clusterServiceSelector:
cluster: pulsarm-cluster
service:
component: broker
service: headless
port: pulsar
- name: milvus-object-storage
namespace: demo
clusterServiceSelector:
cluster: miniom-cluster
service:
component: minio
service: headless
port: api
credential:
component: minio
name: root
configs:
- name: config
variables:
mq_type: pulsar
minio_bucket: milvus
minio_root_path: files
minio_use_path_style: "true"
- name: indexnode
replicas: 1
resources:
limits:
cpu: "0.5"
memory: "0.5Gi"
requests:
cpu: "0.5"
memory: "0.5Gi"
serviceRefs:
- name: milvus-meta-storage
namespace: demo
clusterServiceSelector:
cluster: etcdm-cluster
service:
component: etcd
service: headless
port: client
- name: milvus-log-storage
namespace: demo
clusterServiceSelector:
cluster: pulsarm-cluster
service:
component: broker
service: headless
port: pulsar
- name: milvus-object-storage
namespace: demo
clusterServiceSelector:
cluster: miniom-cluster
service:
component: minio
service: headless
port: api
credential:
component: minio
name: root
configs:
- name: config
variables:
Deploy milvus with OpenTenant
Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has milvus on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.
- Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
- Place the chartmilvus is pinned at v1.2.0-alpha.0 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
- ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below opentenant validate opentenant.yaml terraform init && terraform apply