Not able to create ES cluster with ECK1.9.1

Hi Team,

We trying to create ES-7.16.3 version cluster with ECK 1.9 but ECK is not creating the ES cluster. unfortunately I do not see any errors also in the eck logs.

I tried to create the es cluster using below config like kubectl apply -f es.yaml, then it says imagepullerror, authentication is required to pull the image and cluster will not come up.
Now I run kubectl describe Elasticsearch/Elasticsearch-sample and if I see the content the entire podTemplate section is empty. that's why it is not getting the imagepullsecret from spec section.
The problem I see is somehow ECK is removing the content of pod template and even config also empty.

Below is my ES cluster config file.

apiVersion: elasticsearch.k8s.elastic.co/v1beta1
kind: Elasticsearch
metadata:
  name: elasticsearch-sample
spec:
  version: 7.16.3
  image: ES-custom-image # We build this image with some plugin on top of ES image
  nodeSets:
    - name: master
      count: 3
      config:
        node.roles: ["master"]
        http.compression: true
        http.cors.enabled: true
        http.cors.allow-origin: "*"
        xpack.ml.enabled: false
      podTemplate:
        metadata:
          labels:
            elastic-cluster: "true"
        spec:
          imagePullSecrets:
            - name: imageregistrykey
          initContainers:
            - name: sysctl
              securityContext:
                privileged: true
              command: ['sh', '-c', 'sysctl -w vm.max_map_count=262144']
          containers:
            - name: elasticsearch
              resources:
                requests:
                  memory: 4Gi
                  cpu: 1
                limits:
                  memory: 4Gi
                  cpu: 1
              env:
                - name: ES_JAVA_OPTS
                  value: "-Dlog4j2.formatMsgNoLookups=true"
      volumeClaimTemplates:
        - metadata:
            name: elasticsearch-data
          spec:
            accessModes:
              - ReadWriteOnce
            resources:
              requests:
                storage: 10Gi
            storageClassName: esstorageclass
    - name: data
      count: 2
      config:
        node.roles: ["data"]
        http.compression: true
        http.cors.enabled: true
        http.cors.allow-origin: "*"
        xpack.ml.enabled: false
      podTemplate:
        metadata:
          labels:
            elastic-cluster: "true"
        spec:
          imagePullSecrets:
            - name: imageregistrykey
          initContainers:
            - name: sysctl
              securityContext:
                privileged: true
              command: ['sh', '-c', 'sysctl -w vm.max_map_count=262144']
          containers:
            - name: elasticsearch
              resources:
                requests:
                  memory: 8Gi
                  cpu: 2
                limits:
                  memory: 8Gi
                  cpu: 2
              env:
                - name: ES_JAVA_OPTS
                  value: "-Dlog4j2.formatMsgNoLookups=true"
      volumeClaimTemplates:
        - metadata:
            name: elasticsearch-data
          spec:
            accessModes:
              - ReadWriteOnce
            resources:
              requests:
                storage: 10Gi
            storageClassName: esstorageclass
  http:
    tls:
      selfSignedCertificate:
        disabled: true

when I try to see Elasticsearch config using kubectl describe Elasticsearch Elasticsearch-sample

$ k describe elasticsearch elasticsearch-sample -n eck-es-test1
Name:         elasticsearch-sample
Namespace:    eck-es-test1
Labels:       <none>
Annotations:  common.k8s.elastic.co/controller-version: 1.9.1
              elasticsearch.k8s.elastic.co/initial-master-nodes:
                elasticsearch-sample-es-master-0,elasticsearch-sample-es-master-1,elasticsearch-sample-es-master-2,elasticsearch-sample-es-data-0,elastics...
API Version:  elasticsearch.k8s.elastic.co/v1
Kind:         Elasticsearch
Metadata:
  Creation Timestamp:  2022-03-09T11:39:43Z
  Generation:          2
  Resource Version:    8262372
  UID:                 1234
Spec:
  Auth:
  Http:
    Service:
      Metadata:
      Spec:
    Tls:
      Certificate:
      Self Signed Certificate:
        Disabled:  true
  Image:           es-custom-image
  Monitoring:
    Logs:
    Metrics:
  Node Sets:
    Config:
    Count:  3
    Name:   master
    Pod Template:
      Metadata:
        Creation Timestamp:  <nil>
      Spec:
        Containers:  <nil>
    Volume Claim Templates:
      Metadata:
        Name:  elasticsearch-data
      Spec:
        Access Modes:
          ReadWriteOnce
        Resources:
          Requests:
            Storage:         10Gi
        Storage Class Name:  esstorageclass
      Status:
    Config:
    Count:  2
    Name:   data
    Pod Template:
      Metadata:
        Creation Timestamp:  <nil>
      Spec:
        Containers:  <nil>
    Volume Claim Templates:
      Metadata:
        Name:  elasticsearch-data
      Spec:
        Access Modes:
          ReadWriteOnce
        Resources:
          Requests:
            Storage:         10Gi
        Storage Class Name:  esstorageclass
      Status:
  Transport:
    Service:
      Metadata:
      Spec:
    Tls:
      Certificate:
  Update Strategy:
    Change Budget:
  Version:  7.16.3
Status:
  Health:   unknown
  Phase:    ApplyingChanges
  Version:  7.16.3
Events:     <none>

Why operator is removing the podTemplate section from nodeset ? any help would be appreciated.

Thanks

What version of k8s are you using?

Use apiVersion: elasticsearch.k8s.elastic.co/v1 instead of v1beta1 to fix your issue.

Thank you @Thibault_Richard , somehow I missed this while reading the ECK documentation. Its working fine now after changing the apiVersion.