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. API is not yet stabilized 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. 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.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 managedVLAgentandVLClusterinstances.
VLDistributedZoneCommon
#
vlcluster: CommonVLDistributedZoneClusterconfiguration. Only used whenspec.backendType: VLCluster.vlsingle: CommonVLDistributedZoneSingleconfiguration. Only used whenspec.backendType: VLSingle.vlagent: CommonVLDistributedZoneAgentconfiguration. It buffers and forwards write traffic to the zone backend.remoteWrite: Common remote write settings forVLAgentin each zone. The operator controls the remote write URL.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 name of zone, which is used as default per-zone resource name or can be used inzoneCommontemplate using%ZONE%placeholder.trafficModedefines allowed traffic mode for a zone:read-write,read-only,write-only, ormaintenance.vlclusterdefinesVLDistributedZoneCluster, that allows either reference an existingVLClusterresource or creates a new one. Only used whenspec.backendType: VLCluster.vlsingledefinesVLDistributedZoneSingle, that allows either reference an existingVLSingleresource or creates a new one. Only used whenspec.backendType: VLSingle.vlagentdefinesVLDistributedZoneAgent, that allows either reference an existingVLAgentresource or creates one. It receives write traffic fromvmauthand sends toVLClusterorVLSingleinstances.remoteWritedefines per-zoneVLAgentremote write settings. The operator controls the remote write URL.
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.
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. VLClusterread targets usevlselectAPI paths (/select/...);VLSingleread targets use single-node API paths (/select/...). Both are exposed as areadbackend.
Authorization #
By default VLDistributed provides no access to read/write endpoints. Instead it provides preconfigured named backends read and write, which can be referenced in spec.vmauth.spec.unauthorizedUserAccessSpec section to provide unauthorized access or in VMUser spec for authorized access.
To provide unauthorized access to the distributed setup, add spec.vmauth.spec.unauthorizedUserAccessSpec section, where read and write backends should be referenced:
spec:
vmauth:
spec:
unauthorizedUserAccessSpec:
targetRefs:
- name: read
- name: write
With configuration above both read and write endpoints become available for unauthorized access.
In order to configure authorization, spec.vmauth.spec should have
user selectors
properly configured and VMUser CRs should reference read and write backends in targetRefs:
apiVersion: operator.victoriametrics.com/v1beta1
kind: VMUser
metadata:
name: example
spec:
username: simple-user
password: simple-password
targetRefs:
- name: write
- name: read