How can I make K8S find Elasticsearch Kind type?

9/24/2021

I am following this doc https://www.elastic.co/guide/en/cloud-on-k8s/master/k8s-deploy-elasticsearch.html to deploy Elasticsearch on Kuberenete. I have created the spec file:

apiVersion: elasticsearch.k8s.elastic.co/v1
kind: Elasticsearch
metadata:
  name: quickstart
spec:
  version: 7.15.0
  nodeSets:
  - name: default
    count: 1
    config:
      node.store.allow_mmap: false

But I got an error when run kubectl apply -f es.yml:

 no matches for kind "Elasticsearch" in version "elasticsearch.k8s.elastic.co/v1"

what should I do to solve the issue? It seems K8S doesn't know this kind Elasticsearch. Do I need to install anything?

-- Joey Yi Zhao
elasticsearch
kubernetes

1 Answer

9/24/2021

it looks like you may have omitted to install the custom resource definition (CRD) for elastic.

Kubectl version 1.16 and above:

kubectl create -f https://download.elastic.co/downloads/eck/1.8.0/crds.yaml
kubectl apply -f https://download.elastic.co/downloads/eck/1.8.0/operator.yaml

Kubectl version below 1.16:

kubectl create -f https://download.elastic.co/downloads/eck/1.8.0/crds-legacy.yaml
kubectl apply -f https://download.elastic.co/downloads/eck/1.8.0/operator-legacy.y
-- Paulo
Source: StackOverflow