kubernetes api_error ai_generated true

The CustomResourceDefinition is invalid: status.storedVersions: Invalid value: must have exactly one stored version

ID: kubernetes/k8s-crd-conflict

Also available as: JSON · Markdown
82%Fix Rate
85%Confidence
45Evidence
2023-06-01First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
8 active

Root Cause

CRD version conflict occurs when multiple operators try to manage the same CRD or when upgrading CRDs with incompatible stored versions.

generic

Workarounds

  1. 88% success Migrate CRD stored versions before upgrading: update storedVersions in the CRD status
    kubectl patch crd <name> --subresource=status --type=json -p='[{"op":"replace","path":"/status/storedVersions","value":["v1"]}]'

    Sources: https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definition-versioning/

  2. 85% success Ensure only one operator version manages each CRD — uninstall the old version first
    helm uninstall old-operator && helm install new-operator

    Sources: https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/

Dead Ends

Common approaches that don't work:

  1. Force-delete the CRD and recreate it 90% fail

    Deleting a CRD deletes ALL custom resources of that type — catastrophic data loss

  2. Install both operator versions simultaneously 85% fail

    Two operators managing the same CRD will conflict and corrupt resources

Error Chain

Leads to:
Preceded by:
Frequently confused with: