This guide demonstrates how to manage a Milvus Cluster's operational state in KubeBlocks, including:
These operations help optimize resource usage and reduce operational costs in Kubernetes environments.
Lifecycle management operations in KubeBlocks:
Operation | Effect | Use Case |
---|---|---|
Stop | Suspends cluster, retains storage | Cost savings, maintenance |
Start | Resumes cluster operation | Restore service after pause |
Restart | Recreates pods for component | Configuration changes, troubleshooting |
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.
Stopping a Milvus Cluster in KubeBlocks will:
This operation is ideal for:
Option 1: OpsRequest API
Create a Stop operation request:
apiVersion: operations.kubeblocks.io/v1alpha1
kind: OpsRequest
metadata:
name: milvus-cluster-stop-ops
namespace: demo
spec:
clusterName: milvus-cluster
type: Stop
Option 2: Cluster API
Create a Stop operation request:
apiVersion: operations.kubeblocks.io/v1alpha1
kind: OpsRequest
metadata:
name: milvus-cluster-stop-ops
namespace: demo
spec:
clusterName: milvus-cluster
type: Stop
To confirm a successful stop operation:
Check cluster status transition:
kubectl get cluster milvus-cluster -n demo -w
Example Output:
NAME CLUSTER-DEFINITION TERMINATION-POLICY STATUS AGE
milvus-cluster milvus Delete Stopping 6m33s
milvus-cluster milvus Delete Stopped 6m55s
Verify no running pods:
kubectl get pods -l app.kubernetes.io/instance=milvus-cluster -n demo
Example Output:
No resources found in demo namespace.
Starting a stopped Milvus Cluster:
Expected behavior:
To confirm a successful start operation:
Check cluster status transition:
kubectl get cluster milvus-cluster -n demo -w
Example Output:
NAME CLUSTER-DEFINITION TERMINATION-POLICY STATUS AGE
milvus-cluster milvus Delete Updating 30m
milvus-cluster milvus Delete Updating 32m
milvus-cluster milvus Delete Updating 32m
milvus-cluster milvus Delete Running 33m
milvus-cluster milvus Delete Running 33m
Verify pod recreation:
kubectl get pods -n demo -l app.kubernetes.io/instance=milvus-cluster
Example Output:
NAME READY STATUS RESTARTS AGE
milvus-cluster-datanode-0 1/1 Running 0 5m24s
milvus-cluster-indexnode-0 1/1 Running 0 5m24s
milvus-cluster-mixcoord-0 1/1 Running 0 5m24s
milvus-cluster-proxy-0 1/1 Running 0 5m24s
milvus-cluster-querynode-0 1/1 Running 0 5m24s
milvus-cluster-querynode-1 1/1 Running 0 3m43s
Restart operations provide:
Use cases:
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
Restart Proxy via OpsRequest API
List specific components to be restarted:
apiVersion: operations.kubeblocks.io/v1alpha1
kind: OpsRequest
metadata:
name: milvus-cluster-restart-ops
namespace: demo
spec:
clusterName: milvus-cluster
type: Restart
restart:
- componentName: proxy
Verifying Restart Completion
To verify a successful component restart:
Track OpsRequest progress:
kubectl get opsrequest milvus-cluster-restart-ops -n demo -w
Example Output:
NAME TYPE CLUSTER STATUS PROGRESS AGE
milvus-cluster-restart-ops Restart milvus-cluster Running 0/1 4s
milvus-cluster-restart-ops Restart milvus-cluster Running 1/1 2m12s
milvus-cluster-restart-ops Restart milvus-cluster Running 1/1 2m12s
milvus-cluster-restart-ops Restart milvus-cluster Succeed 1/1 2m12s
Check pod status:
kubectl get pods -n demo -l app.kubernetes.io/instance=milvus-cluster
Note: Pods will show new creation timestamps after restart. Only pods belongs to component proxy
have been restarted.
Once the operation is complete, the cluster will return to the Running state.
In this guide, you learned how to:
By managing the lifecycle of your Milvus Cluster, you can optimize resource utilization, reduce costs, and maintain flexibility in your Kubernetes environment. KubeBlocks provides a seamless way to perform these operations, ensuring high availability and minimal disruption.