VMDistributed is the Custom Resource Definition for orchestrated updates of several VictoriaMetrics clusters. It allows you to define and manage cluster components of a distributed VictoriaMetrics setup and apply changes to them sequentially, ensuring high availability and minimal disruption.
Note: VMDistributed is an experimental feature and may not be suitable for production environments. API is not yet stabilized and may change in future releases.
For a high-level overview of VictoriaMetrics distributed cluster architecture, refer to the official VictoriaMetrics documentation .
Specification #
The VMDistributed resource allows you to configure various aspects of your VictoriaMetrics distributed cluster. The specification includes:
retain: If set totrue, the operator will keep managed components during VMDistributed CR removal.paused: If set totrue, the operator will not perform any actions on the underlying managed objects. Useful for temporarily halting reconciliation.vmauth: Configuration for aVMAuthinstance that acts as a proxy/load-balancer for thevmselectandvmagentcomponents of the managed clusters. It acts as a global read and write path entry point.zoneCommon: DefinesVMDistributedZoneCommoncommon zone configuration, which is default for each zone resource.zones: Defines the list ofVMDistributedZonethat form the distributed setup.license: Configures the license key for enterprise features. If provided, it is automatically passed to the managedVMAuth, allVMAgent, andVMClusterinstances.
VMDistributedZoneCommon
#
readyTimeout: The readiness timeout for each zone update. Default is5m.updatePause: Time the operator should wait between zone updates to ensure a smooth transition. Default is1m.
VMDistributedZone
#
Each entry in the zones array includes:
namedefines name of zone, which is used as for default per zone resource name or can be used inzoneCommontemplate using%ZONE%placeholder.vmclusterdefinesVMDistributedZoneCluster, that allows either reference an existingVMClusterresource or creates a new one.vmagentdefinesVMDistributedZoneAgent, that allows either reference an existingVMAgentresource or creates a one. It receives write traffic fromvmauthand sends tovmclusterinstances.
VMDistributedZoneCluster
#
name: Optional name of an existingVMClusteror one to be created; when omitted it defaults tozoneCommon.vmcluster.name(where%ZONE%is used to template the zone name) or${cr.Name}-${zone.name}when unset.spec: Avmv1beta1.VMClusterSpecobject that defines the desired state of a new or referencedVMClustermanaged by this resource.
Example: Defining a VMDistributed resource:
apiVersion: operator.victoriametrics.com/v1alpha1
kind: VMDistributed
metadata:
name: my-distributed-cluster
spec:
vmauth:
name: my-distributed-vmauth
spec:
replicaCount: 1
zoneCommon:
vmagent:
spec:
replicaCount: 1
vmcluster:
spec:
vmstorage:
replicaCount: 1
storage:
volumeClaimTemplate:
spec:
resources:
requests:
storage: 10Gi
vmselect:
replicaCount: 1
vminsert:
replicaCount: 1
zones:
- name: zone-a
- name: zone-b
VMDistributed and distributed chart #
VMDistributed can be used alongside the resources created by the distributed chart. The distributed chart provides a convenient way to create multiple VMCluster objects and surrounding resources.
In order to update VMClusters in a coordinated manner, add VMCluster resources to the zones list:
spec:
zones:
- name: zone-1
vmcluster:
name: cluster-1
- name: zone-2
vmcluster:
name: cluster-2
- name: zone-3
vmcluster:
name: cluster-3
and set vmauth pointing to global read vmauth:
spec:
vmauth:
name: vmauth-global-read-<release name>
Ownership and references #
VMDistributed owns VMAgents, and VMAuths created or referenced by the distributed chart with the same namespace as the VMDistributed. Only created ones are deleted when the VMDistributed is deleted.
When VMCluster is referenced via ref, these objects will have ownerRef set to the VMDistributed, but they will not be deleted when the VMDistributed is deleted. Instead, only ownerRef will be removed from them.
Current shortcomings #
- Only
VMClusterobjects are supported for distributed management. - Only one
VMAgentand oneVMAuthcan be managed perVMDistributed. - All objects must belong to the same namespace as the
VMDistributed. - Referenced
VMClusterobjects (usingref) are not actively watched for external changes; they are reconciled periodically or when theVMDistributeditself changes. - Objects must be referred to by name; label selectors are not supported for cluster selection.