# The CustomResourceDefinition "elasticsearches.elasticsearch.k8s.elastic.co" is invalid

**URL:** <https://discuss.elastic.co/t/the-customresourcedefinition-elasticsearches-elasticsearch-k8s-elastic-co-is-invalid/218557>\
**Category:** Elastic Cloud on Kubernetes (ECK)\
**Created:** [February 10, 2020, 10:09am UTC](https://discuss.elastic.co/t/the-customresourcedefinition-elasticsearches-elasticsearch-k8s-elastic-co-is-invalid/218557 "2020-02-10T10:09:16Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Abhilash\_B](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/abhilash_b/32/40270_2.png) [@Abhilash\_B](https://discuss.elastic.co/u/Abhilash_B)\
**Post date:** [February 10, 2020, 10:09am UTC](https://discuss.elastic.co/t/the-customresourcedefinition-elasticsearches-elasticsearch-k8s-elastic-co-is-invalid/218557/1 "2020-02-10T10:09:16Z")

</div>

I apply this command on my kubernetes cluster  
`kubectl delete -f https://download.elastic.co/downloads/eck/0.9.0/all-in-one.yaml`

I get this error:

```auto
The CustomResourceDefinition "elasticsearches.elasticsearch.k8s.elastic.co" is invalid:
* status.storedVersions[0]: Invalid value: "v1beta1": must appear in spec.versions
* status.storedVersions[1]: Invalid value: "v1": must appear in spec.versions

```

Any help is highly appreciated.

---

<div class="post-metadata">

**Author:** ![sebgl](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sebgl/32/48702_2.png) [@sebgl](https://discuss.elastic.co/u/sebgl)\
**Post date:** [February 10, 2020, 10:33am UTC](https://discuss.elastic.co/t/the-customresourcedefinition-elasticsearches-elasticsearch-k8s-elastic-co-is-invalid/218557/2 "2020-02-10T10:33:54Z")

</div>

It looks like you had ECK v1.0.0 installed at some point according to the logs.

Are you trying to uninstall ECK completely? You should probably run your delete command with the 1.0.0 URL:

```auto
kubectl delete -f https://download.elastic.co/downloads/eck/1.0.0/all-in-one.yaml

```

---

<div class="post-metadata">

**Author:** ![Abhilash\_B](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/abhilash_b/32/40270_2.png) [@Abhilash\_B](https://discuss.elastic.co/u/Abhilash_B)\
**Post date:** [February 10, 2020, 11:23am UTC](https://discuss.elastic.co/t/the-customresourcedefinition-elasticsearches-elasticsearch-k8s-elastic-co-is-invalid/218557/3 "2020-02-10T11:23:32Z")

</div>

I ran the above command. It says

```auto
customresourcedefinition.apiextensions.k8s.io "apmservers.apm.k8s.elastic.co" deleted
customresourcedefinition.apiextensions.k8s.io "elasticsearches.elasticsearch.k8s.elastic.co" deleted
customresourcedefinition.apiextensions.k8s.io "kibanas.kibana.k8s.elastic.co" deleted
clusterrole.rbac.authorization.k8s.io "elastic-operator" deleted
clusterrolebinding.rbac.authorization.k8s.io "elastic-operator" deleted
namespace "elastic-system" deleted
statefulset.apps "elastic-operator" deleted
serviceaccount "elastic-operator" deleted
Error from server (NotFound): error when deleting "https://download.elastic.co/downloads/eck/1.0.0/all-in-one.yaml": validatingwebhookconfigurations.admissionregistration.k8s.io "elastic-webhook.k8s.elastic.co" not found
Error from server (NotFound): error when deleting "https://download.elastic.co/downloads/eck/1.0.0/all-in-one.yaml": services "elastic-webhook-server" not found
Error from server (NotFound): error when deleting "https://download.elastic.co/downloads/eck/1.0.0/all-in-one.yaml": secrets "elastic-webhook-server-cert" not found

```

I then run

```auto
kubectl delete -f https://download.elastic.co/downloads/eck/0.9.0/all-in-one.yaml

```

then apply command for fresh CRDs of v0.9.0

```auto
kubectl apply -f https://download.elastic.co/downloads/eck/0.9.0/all-in-one.yaml

```

I get again the same error

```auto
customresourcedefinition.apiextensions.k8s.io/apmservers.apm.k8s.elastic.co created
customresourcedefinition.apiextensions.k8s.io/trustrelationships.elasticsearch.k8s.elastic.co created
customresourcedefinition.apiextensions.k8s.io/kibanas.kibana.k8s.elastic.co created
clusterrole.rbac.authorization.k8s.io/elastic-operator created
clusterrolebinding.rbac.authorization.k8s.io/elastic-operator created
namespace/elastic-system created
statefulset.apps/elastic-operator created
secret/webhook-server-secret created
serviceaccount/elastic-operator created
The CustomResourceDefinition "elasticsearches.elasticsearch.k8s.elastic.co" is invalid:
* status.storedVersions[0]: Invalid value: "v1beta1": must appear in spec.versions
* status.storedVersions[1]: Invalid value: "v1": must appear in spec.versions

```

---

<div class="post-metadata">

**Author:** ![sebgl](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sebgl/32/48702_2.png) [@sebgl](https://discuss.elastic.co/u/sebgl)\
**Post date:** [February 12, 2020, 2:52pm UTC](https://discuss.elastic.co/t/the-customresourcedefinition-elasticsearches-elasticsearch-k8s-elastic-co-is-invalid/218557/4 "2020-02-12T14:52:54Z")

</div>

You may have existing `v1` or `v1beta1` Elasticsearch resources around?

```auto
kubectl get elasticsearch --all-namespaces

```

They should be deleted first.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [November 4, 2022, 7:44am UTC](https://discuss.elastic.co/t/the-customresourcedefinition-elasticsearches-elasticsearch-k8s-elastic-co-is-invalid/218557/5 "2022-11-04T07:44:13Z")

</div>


