How to use Milvus and Kubernetes for reverse image search
This guide explains how to use Milvus, an open-source vector database, and Managed Kubernetes on Virtuozzo Infrastructure to build a reverse image search engine.
About reverse image search
Reverse image search (RIS) helps you search for similar or related images given an input image. Reverse image search is a content-based image retrieval (CBIR) query technique that involves providing the CBIR system with a query image that it will then base its search upon.
The example described in this guide is based on the Milvus vector database, which includes everything you need to perform image search. To learn more about similarity search, refer to the Milvus RIS guide and Milvus Bootcamp.
Milvus architecture

For more details, refer to the Milvus documentation.
Prerequisites
1. Deploy a Virtuozzo Infrastructure cluster.
2. Create the compute cluster with the Kubernetes and load balancing services.
3. Configure a storage policy named standard for boot volumes on Kubernetes master nodes. Ensure that the selected policy is available for all projects where you are planning to deploy Kubernetes.
4. Create a Kubernetes cluster.
5. Create the default storage class with the storage policy standard. The storage policy must be available in your project.
| |
Apply the configuration file:
| |
6. Create a storage policy with ReadWriteMany (RWX) support to store Milvus logs. In this example, we recommend deploying an NFS server and NFS external provisioner as the easiest way to get such a storage policy.
7. Ensure that you have the credentials (the access key and secret key) to the object storage service. In this guide, we will use the S3 object storage and a bucket provided by Virtuozzo Infrastructure named milvus.
Important: We recommend using a separate Python virtual environment to run the required Jupiter notebook, as it installs multiple Python modules with specific versions and may break other applications you develop. You will need Python version 3.11.
To learn how to manage virtual environments for Visual Studio Code, refer to Python environments in VS Code.
Deploying the Milvus cluster using Helm
1. Download the example configuration file for Milvus cluster deployment:
| |
2. Connect to your Kubernetes cluster:
| |
3. Install and configure Helm.
4. Change the Helm configuration file according to your environment. You can edit the milvus-virtuozzo.yaml file obtained in step 1 or create your own by using the command helm show values milvus/milvus > milvus.yaml.
In the configuration file:
service.type: LoadBalanceras we recommend using load balancers instead of ingress controllers for this setupservice.loadBalancerSourceRanges: 0.0.0.0/24limits the number of CIDRs to access your Milvus cluster endpoint to the specified IP rangelog.persistence.enabled: trueenables persistent storage for logslog.persistence.persistentVolumeClaim.storageClass: nfsspecifies thenfsstorage policy to store logsattu.enabled: trueinstalls Attu, a management tool for Milvusattu.service.type: LoadBalanceras we recommend using load balancers instead of ingress controllers for this setupminio.enabled: falseas we are going to use a third-party S3 storage instead of MinIOexternalS3.enabled: trueenables an external S3 connectionexternalS3.host: "<s3_server_dns_name>"uses your S3 server DNS name as the S3 access pointexternalS3.port: "443"uses TCP port 443 to access the S3 serverexternalS3.accessKey: "access_key"uses your S3 access key to access the S3 dataexternalS3.secretKey: "secret_key"to your S3 secret key to access the S3 dataexternalS3.useSSL: trueenables SSLexternalS3.bucketName: "milvus"uses the bucket namedmilvus
5. Deploy the Milvus cluster by using the Helm chart:
| |
The deployment takes minimum 5 minutes.
6. Once the deployment is complete, check the pods in your Kubernetes cluster. You should have the following pods up and running:
| |
7. Find out the endpoints for the Milvus services:
| |
You need two endpoints:
- The external IP address of the
milvusservice,<milvus_address>, is the endpoint of Milvus cluster that you will use later for testing. - The external IP address of the
milvus-attuservice,<attu_address>, is the Attu IP address.
8. Access Attu at http://<attu_address>:3000/ under the default user root with the password Milvus and check that your Milvus cluster is up and running.
Testing Milvus
1. Download the Jupyter notebook files:
| |
These files are adapted for the Virtuozzo deployment described above. You can also check the original notebooks. The main difference between the original and Virtuozzo files is that we use the updated versions of Milvus and Gradio with the correct code to run your demo website.
2. Open the Jupyter notebooks by using your favorite IDE, for example, Visual Studio Code or JupyterLab.
3. Change the IP address of the Milvus cluster in both notebooks. To do this, find the Configuration part, and then set HOST to the obtained milvus_address.
Enjoy!