LoginSignup
1
1

CRDの反映で invalid: status.storedVersions になった時の対処法

Last updated at Posted at 2024-03-29

CRDを反映した時に以下のようなエラーになった時の対処方法

The CustomResourceDefinition "foo.bar" is invalid: status.storedVersions[0]: Invalid value: "v1alpha1": must appear in spec.versions

CRDのversionsにv1alpha1,v1beta1が定義されていて、新しく反映するCRDからはv1alpha1が削除されてる時に発生する

以下コマンドを打てば解決する

$ kubectl get crd foo.bar -o yaml | yq .status.storedVersions
- v1alpha1
- v1beta1

$ kubectl patch crd foo.bar -p '{"status":{"storedVersions":["v1beta1"]}}' --subresource=status
customresourcedefinition.apiextensions.k8s.io/foo.bar patched

$ kubectl get crd foo.bar -o yaml | yq .status.storedVersions
- v1beta1
1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1