Not able to create elasticsearch on Azure aks

Im trying to create Elasticsearch on azure Kubernetes service (v 1.20.13) using eck version (1.8.0)

here is my kubernetes deployment script

apiVersion: elasticsearch.k8s.elastic.co/v1

kind: Elasticsearch

metadata:

  name: banana-elastic-depl

spec:

  version: 8.1.2

  nodeSets:

    - name: master-nodes

      count: 1

      config:

        node.roles: ["master"]

      podTemplate:

        spec:

          containers:

            - name: default

              env: #java run time memory allocation

                - name: ES_JAVA_OPTS

                  value: -Xms2g -Xmx2g

          initContainers: #make pod ready for prod mode elastic run

            - name: sysctl

              securityContext:

                privileged: true

              command: ["sh", "-c", "sysctl -w vm.max_map_count=262144"]

      volumeClaimTemplates: #persistent stoarage

        - metadata:

            name: elasticsearch-data

          spec:

            accessModes:

              - ReadWriteOnce

            resources:

              requests:

                storage: 16Gi

            storageClassName: default

    - name: data-nodes

      count: 1

      config:

        node.roles: ["data"]

      volumeClaimTemplates: #persistent stoarage

        - metadata:

            name: elasticsearch-data

          spec:

            accessModes:

              - ReadWriteOnce

            resources:

              requests:

                storage: 64Gi

            storageClassName: default

      podTemplate:

        spec:

          containers:

            - name: elasticsearch

              env: #java run time memory allocation

                - name: ES_JAVA_OPTS

                  value: -Xms2g -Xmx2g

              resources:

                requests:

                  memory: 12Gi

                  cpu: 3

                limits:

                  memory: 16Gi

                  cpu: 4

          initContainers: #make pod ready for prod mode elastic run

            - name: sysctl

              securityContext:

                privileged: true

              command: ["sh", "-c", "sysctl -w vm.max_map_count=262144"]

this script is giving error while creating elastichsearch

{"@timestamp":"2022-04-10T17:06:27.441Z", "log.level": "INFO", "message":"JVM arguments [-Xshare:auto, -Des.networkaddress.cache.ttl=60, -Des.networkaddress.cache.negative.ttl=10, -Djava.security.manager=allow, -XX:+AlwaysPreTouch, -Xss1m, -Djava.awt.headless=true, -Dfile.encoding=UTF-8, -Djna.nosys=true, -XX:-OmitStackTraceInFastThrow, -XX:+ShowCodeDetailsInExceptionMessages, -Dio.netty.noUnsafe=true, -Dio.netty.noKeySetOptimization=true, -Dio.netty.recycler.maxCapacityPerThread=0, -Dio.netty.allocator.numDirectArenas=0, -Dlog4j.shutdownHookEnabled=false, -Dlog4j2.disable.jmx=true, -Dlog4j2.formatMsgNoLookups=true, -Djava.locale.providers=SPI,COMPAT, --add-opens=java.base/java.io=ALL-UNNAMED, -XX:+UseG1GC, -Djava.io.tmpdir=/tmp/elasticsearch-16531016403921520044, -XX:+HeapDumpOnOutOfMemoryError, -XX:+ExitOnOutOfMemoryError, -XX:HeapDumpPath=data, -XX:ErrorFile=logs/hs_err_pid%p.log, -Xlog:gc*,gc+age=trace,safepoint:file=logs/gc.log:utctime,pid,tags:filecount=32,filesize=64m, -Des.cgroups.hierarchy.override=/, -Xms2g, -Xmx2g, -XX:MaxDirectMemorySize=1073741824, -XX:G1HeapRegionSize=4m, -XX:InitiatingHeapOccupancyPercent=30, -XX:G1ReservePercent=15, -Des.path.home=/usr/share/elasticsearch, -Des.path.conf=/usr/share/elasticsearch/config, -Des.distribution.flavor=default, -Des.distribution.type=docker, -Des.bundled_jdk=true]", "ecs.version": "1.2.0","service.name":"ES_ECS","event.dataset":"elasticsearch.server","process.thread.name":"main","log.logger":"org.elasticsearch.node.Node","elasticsearch.node.name":"banana-elastic-depl-es-data-nodes-0","elasticsearch.cluster.name":"banana-elastic-depl"}

am i missing something?

regards

Hi,

There is no error in your log. Since you are using Elasticsearch 8.0 and you want to manage vm.max_map_count using an init container could you also set runAsUser: 0 in the securityContext ? See a full example in the documentation.

Thanks

Thank you michael adding this worked. also slightly modified my deployment yaml

apiVersion: elasticsearch.k8s.elastic.co/v1

kind: Elasticsearch

metadata:

  name: banana-elastic-depl

spec:

  version: 8.1.2

  nodeSets:

    - name: master-nodes

      count: 1

      config:

        node.roles: ["master"]

      volumeClaimTemplates: #persistent stoarage

        - metadata:

            name: elasticsearch-data

          spec:

            accessModes:

              - ReadWriteOnce

            resources:

              requests:

                storage: 16Gi

            storageClassName: default

    - name: data-nodes

      count: 1

      config:

        node.roles: ["data"]

      volumeClaimTemplates: #persistent stoarage

        - metadata:

            name: elasticsearch-data

          spec:

            accessModes:

              - ReadWriteOnce

            resources:

              requests:

                storage: 64Gi

            storageClassName: default

      podTemplate:

        spec:

          containers:

            - name: elasticsearch

              env: #java run time memory allocation

                - name: ES_JAVA_OPTS

                  value: -Xms2g -Xmx2g

              resources:

                requests:

                  memory: 12Gi

                  cpu: 3

                limits:

                  memory: 16Gi

                  cpu: 4

          initContainers: #make pod ready for prod mode elastic run

            - name: sysctl

              securityContext:

                privileged: true

                runAsUser: 0

              command: ["sh", "-c", "sysctl -w vm.max_map_count=262144"]

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