VictoriaMetrics / VictoriaMetrics/operator

VMAgent and VPA: fails when .spec.shardCount is unset

Open
#2,473 0 comments 0 reactions 1 assignee View on GitHub

@AndrewChubatiuk is already working on this.

Since Aug 6, 2026.

bug waiting for release
Dominant language
Go
Stars
589
Forks
229
Avg merge
1d 9h
Merged PRs (30d)
77

Description

Problem

Using victoria-metrics-k8s-stack and enabling vpa for vmagent still produces an error that ".spec.shardCount" does not exist.

Versions

victoria-metrics-k8s-stack:0.88.0
vm-operator: v0.74.0

VPA

apiVersion: autoscaling.k8s.io/v1
kind: VerticalPodAutoscaler
metadata:
  labels:
    app.kubernetes.io/component: monitoring
    app.kubernetes.io/instance: victoriametrics-eu-west1
    app.kubernetes.io/name: vmagent
    managed-by: vm-operator
  name: victoriametrics-eu-west1
  namespace: monitoring
  ownerReferences:
  - apiVersion: operator.victoriametrics.com/v1beta1
    blockOwnerDeletion: true
    controller: true
    kind: VMAgent
    name: victoriametrics-eu-west1
spec:
  resourcePolicy:
    containerPolicies:
    - containerName: '*'
  targetRef:
    apiVersion: operator.victoriametrics.com/v1beta1
    kind: VMAgent
    name: victoriametrics-eu-west1
  updatePolicy:
    updateMode: InPlaceOrRecreate
status:
  conditions:
  - lastTransitionTime: "2026-08-04T09:55:44Z"
    message: 'Cannot read targetRef. Reason: unhandled targetRef operator.victoriametrics.com/v1beta1
      / VMAgent / victoriametrics-eu-west1, last error Internal error occurred: the
      spec replicas field ".spec.shardCount" does not exist'
    status: "True"
    type: ConfigUnsupported
  - lastTransitionTime: "2026-08-04T09:55:44Z"
    message: 'No recommendation provided from the recommendation engine: No pods found.'
    reason: 'No recommendation provided from the recommendation engine: No pods found.'
    status: "False"
    type: RecommendationProvided
  recommendation: {}

VMAgent

apiVersion: operator.victoriametrics.com/v1beta1
kind: VMAgent
metadata:
  annotations:
    meta.helm.sh/release-name: victoriametrics
    meta.helm.sh/release-namespace: monitoring
  labels:
    app.kubernetes.io/component: vmagent
    app.kubernetes.io/instance: victoriametrics
    app.kubernetes.io/managed-by: Helm
    app.kubernetes.io/name: eu-west1
    app.kubernetes.io/version: v1.148.0
    helm.sh/chart: victoria-metrics-k8s-stack-0.88.0_216b0562e4f4
    helm.toolkit.fluxcd.io/name: victoriametrics
    helm.toolkit.fluxcd.io/namespace: monitoring
  name: victoriametrics-eu-west1
  namespace: monitoring
spec:
  externalLabels:
    cluster: eu-west1
  extraArgs:
    promscrape.streamParse: "true"
  image:
    tag: v1.148.0
  podDisruptionBudget:
    minAvailable: 1
  port: "8429"
  readinessProbe:
    initialDelaySeconds: 5
    periodSeconds: 10
    successThreshold: 1
    timeoutSeconds: 5
  remoteWrite:
  - url: http://vminsert-victoriametrics-eu-west4.monitoring.svc.clusterset.local:8480/insert/0/prometheus/api/v1/write
  - url: http://vminsert-victoriametrics-eu-west1.monitoring.svc.cluster.local:8480/insert/0/prometheus/api/v1/write
  replicaCount: 2
  resources:
    limits:
      memory: 700Mi
    requests:
      cpu: "0.2"
      memory: 700Mi
  scrapeInterval: 20s
  selectAllByDefault: true
  vpa:
    resourcePolicy:
      containerPolicies:
      - containerName: '*'
    updatePolicy:
      updateMode: InPlaceOrRecreate

.status.shards is 1

Description

so running kubectl get --raw /apis/operator.victoriametrics.com/v1beta1/namespaces/monitoring/vmagents/victoriametrics-eu-west1/scale gets
Error from server (InternalError): Internal error occurred: the spec replicas field ".spec.shardCount" does not exist

I have found issue https://github.com/VictoriaMetrics/operator/issues/2229 related to this. With the newest update the target is now VMAgent, but still needing .spec.shardCount set.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.