Elasticsearch container resources not recognized

I have deployed the operator according to the following document and it is running fine. Then I created the following elastic search but the pods for elastic search is not getting created.

https://www.elastic.co/guide/en/cloud-on-k8s/current/k8s-quickstart.html

# This sample sets up an Elasticsearch cluster with 3 nodes.
apiVersion: elasticsearch.k8s.elastic.co/v1alpha1
kind: Elasticsearch
metadata:
  name: elasticsearch-sample
spec:
  version: 7.2.0
  nodes:
  - config:
      # most Elasticsearch configuration parameters are possible to set, e.g:
      node.master: true
      node.data: true
      node.ingest: true
    podTemplate:
      metadata:
        labels:
          # additional labels for pods
          foo: bar
      spec:
        containers:
        - name: elasticsearch
          # specify resource limits and requests
          resources:
            limits:
              memory: 4Gi
            requests:
              memory: 2Gi
          env:
          - name: ES_JAVA_OPTS
            value: "-Xms2g -Xmx2g"
    nodeCount: 3
    volumeClaimTemplates:
    - metadata:
        name: data
      spec:
        accessModes:
        - ReadWriteOnce
        resources:
          requests:
            storage: 5Gi
        storageClassName: fastest

It gives the following error events:

Events:
  Type     Reason      Age                      From                      Message
  ----     ------      ----                     ----                      -------
  Warning  Unexpected  2m34s (x132 over 7m34s)  elasticsearch-controller  Cannot create pod elasticsearch-sample-es-44qch28x27: pods "elasticsearch-sample-es-44qch28x27" is forbidden: failed quota: ns-elastic-system: must specify limits.memory,requests.memory
  Warning  Unexpected  2m31s (x132 over 7m32s)  elasticsearch-controller  Cannot create pod elasticsearch-sample-es-44qch28x27: pods "elasticsearch-sample-es-44qch28x27" is forbidden: failed quota: ns-elastic-system: must specify limits.memory,requests.memory

FYI, I have Resourcequota in my namespace. But as the pod template of elasticsearch has memory resource specifically defined, I am confused why this "elasticsearch-controller" still getting this issue.

apiVersion: v1
kind: ResourceQuota
metadata:
  name: ns-elastic-system
  namespace: elastic-system
spec:
  hard:
    limits.memory: 25Gi
    persistentvolumeclaims: "10"
    requests.memory: 15Gi
    requests.storage: 100Gi

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