VLDistributed is the Custom Resource Definition for orchestrated updates of several VictoriaLogs clusters or single-node instances. It allows you to define and manage components of a distributed VictoriaLogs setup and apply changes to them sequentially, ensuring high availability and minimal disruption.
Note: VLDistributed is an experimental feature and may not be suitable for production environments. The API is not yet stable and may change in future releases.

For a high-level overview of VictoriaLogs distributed architecture, refer to the official VictoriaLogs cluster documentation .
Specification #
The VLDistributed resource allows you to configure various aspects of your VictoriaLogs distributed setup. The specification includes:
retain: If set totrue, the operator will keep managed components during VLDistributed CR removal.paused: If set totrue, the operator will not perform any actions on the underlying managed objects, except removing theVLDistributeditself. Useful for temporarily halting reconciliation.backendType: Specifies the backend type for all zones. EitherVLCluster(default) orVLSingle. All zones must use the same backend type.vmauth: Configuration for aVMAuthinstance that acts as a proxy/load-balancer for read and write access to the managed VictoriaLogs backends. Its name defaults to theVLDistributedname. Setvmauth.enabled: falseto skip creating it.zoneCommon: DefinesVLDistributedZoneCommoncommon zone configuration, which is default for each zone resource.zones: Defines the list ofVLDistributedZonethat form the distributed setup.license: Configures the license key for enterprise features. If provided, it is automatically passed to the managedVMAuth, allVLAgent,VLCluster, andVLSingleinstances, unless they set their ownlicense.
VLDistributedZoneCommon
#
Every field except readyTimeout and updatePause is a default for each zone and can use the %ZONE% placeholder. Values set in a zone are merged on top of it.
vlcluster: DefaultVLDistributedZoneClusterfor each zone. Must not be set whenspec.backendType: VLSingle.vlsingle: DefaultVLDistributedZoneSinglefor each zone. Must not be set whenspec.backendType: VLCluster.vlagent: DefaultVLDistributedZoneAgentfor each zone. Itsspecsupports a subset ofVLAgentSpecfields. Remote write targets are managed by the operator; useremoteWritebelow for their settings.remoteWrite: Default remote write settings that every zone’svlagentuses to write to the zone’s backend:basicAuth,bearerTokenSecret,bearerTokenPath,oauth2,tlsConfig,sendTimeout,headers,maxDiskUsageandproxyURL. The URL is set by the operator.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.
VLDistributedZone
#
Each entry in the zones array includes:
namedefines the zone name. It is used for default per-zone resource names and replaces the%ZONE%placeholder inzoneCommon.trafficModecontrols which trafficvmauthroutes to the zone:read-write(default when unset): the zone serves reads and writes.read-only: the zone is removed from thewritebackend. ForVLCluster,vlinsertis scaled to 0, sovlagentbuffers the zone’s data until writes are enabled again.write-only: the zone is removed from thereadbackend.maintenance: the zone is removed from both backends, andvlinsertis scaled to 0 like inread-only.
vlclusterdefinesVLDistributedZoneCluster, which either references an existingVLClusterresource or creates a new one. Must not be set whenspec.backendType: VLSingle.vlsingledefinesVLDistributedZoneSingle, which either references an existingVLSingleresource or creates a new one. Must not be set whenspec.backendType: VLCluster.vlagentdefinesVLDistributedZoneAgent, which either references an existingVLAgentresource or creates a new one. It receives write traffic fromvmauthand sends it to theVLClusterorVLSingleof every zone.remoteWriteoverrideszoneCommon.remoteWritefor writes to this zone’s backend, from every zone’svlagent.
VLDistributedZoneCluster
#
name: Optional name of an existingVLClusteror one to be created; when omitted it defaults tozoneCommon.vlcluster.name(where%ZONE%is used to template the zone name) or${cr.Name}-${zone.name}when unset.spec: AVLClusterSpecobject that defines the desired state of a new or referencedVLClustermanaged by this resource.
VLDistributedZoneSingle
#
name: Optional name of an existingVLSingleor one to be created; when omitted it defaults tozoneCommon.vlsingle.name(where%ZONE%is used to template the zone name) or${cr.Name}-${zone.name}when unset.spec: AVLSingleSpecobject that defines the desired state of a new or referencedVLSinglemanaged by this resource.
Example: Defining a VLDistributed resource with VLCluster backend:
apiVersion: operator.victoriametrics.com/v1alpha1
kind: VLDistributed
metadata:
name: my-distributed-logs
spec:
vmauth:
name: my-distributed-vmauth
spec:
replicaCount: 1
unauthorizedUserAccessSpec:
targetRefs:
- name: read
- name: write
zoneCommon:
vlagent:
spec:
replicaCount: 1
vlcluster:
spec:
vlstorage:
replicaCount: 1
vlselect:
replicaCount: 1
vlinsert:
replicaCount: 1
zones:
- name: zone-a
- name: zone-b
vlcluster:
spec:
vlselect:
replicaCount: 2
Example: Defining a VLDistributed resource with VLSingle backend:
apiVersion: operator.victoriametrics.com/v1alpha1
kind: VLDistributed
metadata:
name: my-distributed-log-singles
spec:
backendType: VLSingle
vmauth:
name: my-distributed-vmauth
spec:
replicaCount: 1
unauthorizedUserAccessSpec:
targetRefs:
- name: read
- name: write
zoneCommon:
vlagent:
spec:
replicaCount: 1
vlsingle:
spec:
retentionPeriod: "30d"
zones:
- name: zone-a
- name: zone-b
vlsingle:
spec:
retentionPeriod: "14d"
Ownership and references #
VLDistributed creates or becomes an owner of existing VMAuth, VLAgent, VLCluster, and VLSingle resources and by default it removes all resources it owns on CR deletion. To remove VLDistributed but keep all owned resources set spec.retain: true before VLDistributed removal.
When a zone references an existing VLAgent, VLCluster or VLSingle by name, VLDistributed takes ownership of it and replaces its spec with the one built from zoneCommon and the zone. Fields that are set only on the existing object are lost.
Multitenancy #
Zone VLAgents send logs to the /insert/multitenant/native endpoint of VLCluster and VLSingle backends,
so every log keeps the tenant it was ingested with via AccountID and ProjectID headers.
Backends must run VictoriaLogs v1.49.0 or newer.
See
these docs
.
Current shortcomings #
- Only one
VMAuthcan be managed perVLDistributed. - All objects must belong to the same namespace as the
VLDistributed. - Objects must be referred to by name; label selectors are not supported for
VMAuth,VLAgent,VLClusterorVLSingleselection. VLAgent,VLClusterandVLSinglenames must be unique across zones within oneVLDistributedresource.- All zones must use the same backend type (controlled by
spec.backendType); mixingVLClusterandVLSinglezones in oneVLDistributedis not supported.
Authorization #
By default, the VMAuth created by VLDistributed is not open: it rejects all read and write requests. This is on purpose. Opening it to everyone would let anyone who can reach it read and write data, and creating a default user would mean the operator picks a username, password and permissions for you. So you decide how clients get access.
The operator gives the VMAuth two named backends: read sends queries to the zones, and write sends data to the zones. To open access, list them in targetRefs in one of two ways:
- Anonymous access: no username or password. Simple, and fine for testing or a trusted network.
- Access with credentials: through
VMUserobjects. Each client needs a username and password, and can be given onlyreador onlywrite.
Anonymous access #
Reference both backends in spec.vmauth.spec.unauthorizedUserAccessSpec:
spec:
vmauth:
spec:
unauthorizedUserAccessSpec:
targetRefs:
- name: read
- name: write
Any client that can reach the VMAuth service can now read and write without credentials.
Access with credentials #
Leave unauthorizedUserAccessSpec unset and make the VMAuth select VMUser objects, either with selectAllByDefault: true or with
user selectors
:
spec:
vmauth:
spec:
selectAllByDefault: true
Then create a VMUser for each client and reference the backends it may use in targetRefs:
apiVersion: operator.victoriametrics.com/v1beta1
kind: VMUser
metadata:
name: example
spec:
username: simple-user
password: simple-password
targetRefs:
- name: read
- name: write # omit for a read-only client