Deploying elasticsearch cluster on kubernetes issue

Hello,

I am trying to deploy elasticsearch 7.7.1 on kubernetes into a 3 node cluster. I have tried following the documentation for it and when I run kubectl apply -f <manifestfile>.yaml I am getting the following error:

error: unable to recognize "<manifestfile>.yaml": no matches for kind "Elasticsearch" in version "elasticsearch.k8s.elastic.co/v1"

the yaml file looks like this:

---
apiVersion: elasticsearch.k8s.elastic.co/v1
kind: Elasticsearch
metadata:
  name: elasticsearch
spec:
  baseImage: registry/elasticsearch
  tag: v7.7.1
  version: 7.7.1
  nodeSets:
  - name: default
    count: 3
    config:
      node.master: true
      node.data: true
      node.store.allow_mmap: true
    podTemplate:
      metadata:
        labels:
          app: elasticsearch
      spec:
        containers:
        - name: elasticsearch
          image: registry/elasticsearch:v7.7.1
          env:
          - name: ES_JAVA_OPTS
            values: -Xms4g -Xmx4g
          resources:
            requests:
            memory: 4Gi
            cpu: 1
          limits:
            memory: 5Gi
          volumeMounts:
        - name: es-storage
          mountPath: /var/lib/elasticsearch
        volumes:
        - name: es-local-claim
          persistentVolumeClaim:
            claimName: es-storage

Any idea what I am doing wrong?

I am not expert because I have never deployed Elasticsearch in k8s.

Nevertheless, it appears you may have missed some step in your deployment procedure. Kubernetes api complains about not being able to recognise the kind "Elasticsearch".

I suppose this happens because there has not been any CRDs created specifying this kind Elasticsearch.

My piece of advice, be sure you are not missing any step before creating the Elasticsearch object. Besides, could you share please the steps you are following to deploy Elasticsearch in kubernetes?

Hope it helps,

The quickstart documentation does not say anything about CRD's see https://www.elastic.co/guide/en/cloud-on-k8s/current/k8s-deploy-elasticsearch.html

I think you have to deploy the operator first. Did u do it?

Great I have installed it via HELM and it's crashing because arm64 is not supported.

In the container registry of elastic there seems to be images arm64 compatible. Maybe you can deploy elasticsearch (if you dont want the whole stack nor ECK), running in k8s.

You could create a Deployment out of one of these images, configure its storage and inject the config with a ConfigMap.

Hope it helps,

Let's say I create a 3 node cluster using deployemnts and replica:3. how will I make those tree pods talk to eachother

I suppose that the best approach would be three different StatefulSets for each Elasticsearch pod, if you prefer it can be Deployments, instead.
Expose each Deployment and then make sure Service object uses ports 9200 and 9300. If you do not have 9300 cluster communication is not going to work.
Each of the pods is going to have a different PVC mounted in /var/lib/elasticsearch.

I think this is the best way to proceed, bearing in mind Elasticsearch is a Stateful application.

In fact I needed arm/v7 which it isn't. I am guessing I am about to build my own docker images for that architecture.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.