How can i fix this code elasitcsearch on kubernetes

8/30/2019

I want to create elasticsearch pod on kubernetes.

I make some config change to edit path.data and path.logs

elasticsearch-config is not work

Back-off restarting failed container


elasticsearch.yml:

apiVersion: v1
kind: ConfigMap
metadata:
  name: elasticsearch-config
data:
  elasticsearch.yml: |
    cluster:
      name: ${CLUSTER_NAME:elasticsearch-default}

    node:
      master: ${NODE_MASTER:true}
      data: ${NODE_DATA:true}
      name: ${NODE_NAME}
      ingest: ${NODE_INGEST:true}
      max_local_storage_nodes: ${MAX_LOCAL_STORAGE_NODES:1}

    processors: ${PROCESSORS:1}

    network.host: ${NETWORK_HOST:_site_}

    path:
      data: ${DATA_PATH:"/data/elk"}
      repo: ${REPO_LOCATIONS:[]}

    bootstrap:
      memory_lock: ${MEMORY_LOCK:false}

    http:
      enabled: ${HTTP_ENABLE:true}
      compression: true
      cors:
        enabled: true
        allow-origin: "*"

    discovery:
      zen:
        ping.unicast.hosts: ${DISCOVERY_SERVICE:elasticsearch-discovery}
        minimum_master_nodes: ${NUMBER_OF_MASTERS:1}

    xpack:
      license.self_generated.type: basic

es-deploy.yml:

apiVersion: apps/v1beta1
kind: Deployment
metadata:
  name: es
  labels:
    component: elasticsearch
spec:
  replicas: 1
  template:
    metadata:
      labels:
        component: elasticsearch
    spec:
      serviceAccount: elasticsearch
      initContainers:
        - name: init-sysctl
          image: busybox
          imagePullPolicy: IfNotPresent
          command: ["sysctl", "-w", "vm.max_map_count=262144"]
          securityContext:
            privileged: true
      containers:
        - name: es
          securityContext:
            capabilities:
              add:
                - IPC_LOCK
          image: docker.elastic.co/elasticsearch/elasticsearch:7.3.0
          env:
            - name: NAMESPACE
              valueFrom:
                fieldRef:
                  fieldPath: metadata.namespace
            - name: "DISCOVERY_SERVICE"
              value: "elasticsearch"
            - name: NODE_MASTER
              value: "true"
            - name: NODE_DATA
              value: "true"
            - name: HTTP_ENABLE
              value: "true"
            - name: ES_JAVA_OPTS
              value: "-Xms256m -Xmx256m"
          ports:
            - containerPort: 9200
              name: http
              protocol: TCP
            - containerPort: 9300
              name: transport
              protocol: TCP
          volumeMounts:
           - name: storage
             mountPath: /data/elk
           - name: config-volume
             mountPath: /usr/share/elasticsearch/elastic.yaml
          volumes:
            - name: storage
              emptyDir: {}
            - name: config-volume
              configMap:
                name: elasticsearch-config

pod log:

OpenJDK 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future

release. {"type": "server", "timestamp": "2019-08-30T07:00:21,096+0000", "level": "INFO", "component": "o.e.e.NodeEnvironment", "cluster.name": "docker-cluster", "node.name": "es-865cfff449-pw8w7", "message": "using [1] data paths, mounts [[/ (rootfs)]], net usable_space [33.1gb], net total_space [40.6gb], types [rootfs]" } {"type": "server", "timestamp": "2019-08-30T07:00:21,099+0000", "level": "INFO", "component": "o.e.e.NodeEnvironment", "cluster.name": "docker-cluster", "node.name": "es-865cfff449-pw8w7", "message": "heap size [247.6mb], compressed ordinary object pointers [true]" } {"type": "server", "timestamp": "2019-08-30T07:00:21,101+0000", "level": "INFO", "component": "o.e.n.Node", "cluster.name": "docker-cluster", "node.name": "es-865cfff449-pw8w7", "message": "node name [es-865cfff449-pw8w7], node ID [g2kO6EwHRGKh8XCuPXciXQ], cluster name [docker-cluster]" } {"type": "server", "timestamp": "2019-08-30T07:00:21,102+0000", "level": "INFO", "component": "o.e.n.Node", "cluster.name": "docker-cluster", "node.name": "es-865cfff449-pw8w7", "message": "version[7.3.0], pid[1], build[default/docker/de777fa/2019-07-24T18:30:11.767338Z], OS[Linux/3.10.0-957.27.2.el7.x86_64/amd64], JVM[Oracle Corporation/OpenJDK 64-Bit Server VM/12.0.1/12.0.1+12]" } {"type": "server", "timestamp": "2019-08-30T07:00:21,102+0000", "level": "INFO", "component": "o.e.n.Node", "cluster.name": "docker-cluster", "node.name": "es-865cfff449-pw8w7", "message": "JVM home [/usr/share/elasticsearch/jdk]" } {"type": "server", "timestamp": "2019-08-30T07:00:21,102+0000", "level": "INFO", "component": "o.e.n.Node", "cluster.name": "docker-cluster", "node.name": "es-865cfff449-pw8w7", "message": "JVM arguments [-Xms1g, -Xmx1g, -XX:+UseConcMarkSweepGC, -XX:CMSInitiatingOccupancyFraction=75, -XX:+UseCMSInitiatingOccupancyOnly, -Des.networkaddress.cache.ttl=60, -Des.networkaddress.cache.negative.ttl=10, -XX:+AlwaysPreTouch, -Xss1m, -Djava.awt.headless=true, -Dfile.encoding=UTF-8, -Djna.nosys=true, -XX:-OmitStackTraceInFastThrow, -Dio.netty.noUnsafe=true, -Dio.netty.noKeySetOptimization=true, -Dio.netty.recycler.maxCapacityPerThread=0, -Dlog4j.shutdownHookEnabled=false, -Dlog4j2.disable.jmx=true, -Djava.io.tmpdir=/tmp/elasticsearch-7221944647497330746, -XX:+HeapDumpOnOutOfMemoryError, -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, -Djava.locale.providers=COMPAT, -Des.cgroups.hierarchy.override=/, -Xms256m, -Xmx256m, -Dio.netty.allocator.type=unpooled, -XX:MaxDirectMemorySize=134217728, -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]" } {"type": "server", "timestamp": "2019-08-30T07:00:22,734+0000", "level": "INFO", "component": "o.e.p.PluginsService", "cluster.name": "docker-cluster", "node.name": "es-865cfff449-pw8w7", "message": "loaded module [aggs-matrix-stats]" } {"type": "server", "timestamp": "2019-08-30T07:00:22,735+0000", "level": "INFO", "component": "o.e.p.PluginsService", "cluster.name": "docker-cluster", "node.name": "es-865cfff449-pw8w7", "message": "loaded module [analysis-common]" } {"type": "server", "timestamp": "2019-08-30T07:00:22,736+0000", "level": "INFO", "component": "o.e.p.PluginsService", "cluster.name": "docker-cluster", "node.name": "es-865cfff449-pw8w7", "message": "loaded module [data-frame]" } {"type": "server", "timestamp": "2019-08-30T07:00:22,736+0000", "level": "INFO", "component": "o.e.p.PluginsService", "cluster.name": "docker-cluster", "node.name": "es-865cfff449-pw8w7", "message": "loaded module [flattened]" } {"type": "server", "timestamp": "2019-08-30T07:00:22,737+0000", "level": "INFO", "component": "o.e.p.PluginsService", "cluster.name": "docker-cluster", "node.name": "es-865cfff449-pw8w7", "message": "loaded module [ingest-common]" } {"type": "server", "timestamp": "2019-08-30T07:00:22,737+0000", "level": "INFO", "component": "o.e.p.PluginsService", "cluster.name": "docker-cluster", "node.name": "es-865cfff449-pw8w7", "message": "loaded module [ingest-geoip]" } {"type": "server", "timestamp": "2019-08-30T07:00:22,737+0000", "level": "INFO", "component": "o.e.p.PluginsService", "cluster.name": "docker-cluster", "node.name": "es-865cfff449-pw8w7", "message": "loaded module [ingest-user-agent]" } {"type": "server", "timestamp": "2019-08-30T07:00:22,738+0000", "level": "INFO", "component": "o.e.p.PluginsService", "cluster.name": "docker-cluster", "node.name": "es-865cfff449-pw8w7", "message": "loaded module [lang-expression]" } {"type": "server", "timestamp": "2019-08-30T07:00:22,739+0000", "level": "INFO", "component": "o.e.p.PluginsService", "cluster.name": "docker-cluster", "node.name": "es-865cfff449-pw8w7", "message": "loaded module [lang-mustache]" } {"type": "server", "timestamp": "2019-08-30T07:00:22,739+0000", "level": "INFO", "component": "o.e.p.PluginsService", "cluster.name": "docker-cluster", "node.name": "es-865cfff449-pw8w7", "message": "loaded module [lang-painless]" } {"type": "server", "timestamp": "2019-08-30T07:00:22,740+0000", "level": "INFO", "component": "o.e.p.PluginsService", "cluster.name": "docker-cluster", "node.name": "es-865cfff449-pw8w7", "message": "loaded module [mapper-extras]" } {"type": "server", "timestamp": "2019-08-30T07:00:22,740+0000", "level": "INFO", "component": "o.e.p.PluginsService", "cluster.name": "docker-cluster", "node.name": "es-865cfff449-pw8w7", "message": "loaded module [parent-join]" } {"type": "server", "timestamp": "2019-08-30T07:00:22,740+0000", "level": "INFO", "component": "o.e.p.PluginsService", "cluster.name": "docker-cluster", "node.name": "es-865cfff449-pw8w7", "message": "loaded module [percolator]" } {"type": "server", "timestamp": "2019-08-30T07:00:22,741+0000", "level": "INFO", "component": "o.e.p.PluginsService", "cluster.name": "docker-cluster", "node.name": "es-865cfff449-pw8w7", "message": "loaded module [rank-eval]" } {"type": "server", "timestamp": "2019-08-30T07:00:22,741+0000", "level": "INFO", "component": "o.e.p.PluginsService", "cluster.name": "docker-cluster", "node.name": "es-865cfff449-pw8w7", "message": "loaded module [reindex]" } {"type": "server", "timestamp": "2019-08-30T07:00:22,741+0000", "level": "INFO", "component": "o.e.p.PluginsService", "cluster.name": "docker-cluster", "node.name": "es-865cfff449-pw8w7", "message": "loaded module [repository-url]" } {"type": "server", "timestamp": "2019-08-30T07:00:22,742+0000", "level": "INFO", "component": "o.e.p.PluginsService", "cluster.name": "docker-cluster", "node.name": "es-865cfff449-pw8w7", "message": "loaded module [transport-netty4]" } {"type": "server", "timestamp": "2019-08-30T07:00:22,742+0000", "level": "INFO", "component": "o.e.p.PluginsService", "cluster.name": "docker-cluster", "node.name": "es-865cfff449-pw8w7", "message": "loaded module [vectors]" } {"type": "server", "timestamp": "2019-08-30T07:00:22,742+0000", "level": "INFO", "component": "o.e.p.PluginsService", "cluster.name": "docker-cluster", "node.name": "es-865cfff449-pw8w7", "message": "loaded module [x-pack-ccr]" } {"type": "server", "timestamp": "2019-08-30T07:00:22,742+0000", "level": "INFO", "component": "o.e.p.PluginsService", "cluster.name": "docker-cluster", "node.name": "es-865cfff449-pw8w7", "message": "loaded module [x-pack-core]" } {"type": "server", "timestamp": "2019-08-30T07:00:22,742+0000", "level": "INFO", "component": "o.e.p.PluginsService", "cluster.name": "docker-cluster", "node.name": "es-865cfff449-pw8w7", "message": "loaded module [x-pack-deprecation]" } {"type": "server", "timestamp": "2019-08-30T07:00:22,743+0000", "level": "INFO", "component": "o.e.p.PluginsService", "cluster.name": "docker-cluster", "node.name": "es-865cfff449-pw8w7", "message": "loaded module [x-pack-graph]" } {"type": "server", "timestamp": "2019-08-30T07:00:22,743+0000", "level": "INFO", "component": "o.e.p.PluginsService", "cluster.name": "docker-cluster", "node.name": "es-865cfff449-pw8w7", "message": "loaded module [x-pack-ilm]" } {"type": "server", "timestamp": "2019-08-30T07:00:22,743+0000", "level": "INFO", "component": "o.e.p.PluginsService", "cluster.name": "docker-cluster", "node.name": "es-865cfff449-pw8w7", "message": "loaded module [x-pack-logstash]" } {"type": "server", "timestamp": "2019-08-30T07:00:22,743+0000", "level": "INFO", "component": "o.e.p.PluginsService", "cluster.name": "docker-cluster", "node.name": "es-865cfff449-pw8w7", "message": "loaded module [x-pack-ml]" } {"type": "server", "timestamp": "2019-08-30T07:00:22,743+0000", "level": "INFO", "component": "o.e.p.PluginsService", "cluster.name": "docker-cluster", "node.name": "es-865cfff449-pw8w7", "message": "loaded module [x-pack-monitoring]" } {"type": "server", "timestamp": "2019-08-30T07:00:22,743+0000", "level": "INFO", "component": "o.e.p.PluginsService", "cluster.name": "docker-cluster", "node.name": "es-865cfff449-pw8w7", "message": "loaded module [x-pack-rollup]" } {"type": "server", "timestamp": "2019-08-30T07:00:22,743+0000", "level": "INFO", "component": "o.e.p.PluginsService", "cluster.name": "docker-cluster", "node.name": "es-865cfff449-pw8w7", "message": "loaded module [x-pack-security]" } {"type": "server", "timestamp": "2019-08-30T07:00:22,743+0000", "level": "INFO", "component": "o.e.p.PluginsService", "cluster.name": "docker-cluster", "node.name": "es-865cfff449-pw8w7", "message": "loaded module [x-pack-sql]" } {"type": "server", "timestamp": "2019-08-30T07:00:22,744+0000", "level": "INFO", "component": "o.e.p.PluginsService", "cluster.name": "docker-cluster", "node.name": "es-865cfff449-pw8w7", "message": "loaded module [x-pack-voting-only-node]" } {"type": "server", "timestamp": "2019-08-30T07:00:22,744+0000", "level": "INFO", "component": "o.e.p.PluginsService", "cluster.name": "docker-cluster", "node.name": "es-865cfff449-pw8w7", "message": "loaded module [x-pack-watcher]" } {"type": "server", "timestamp": "2019-08-30T07:00:22,744+0000", "level": "INFO", "component": "o.e.p.PluginsService", "cluster.name": "docker-cluster", "node.name": "es-865cfff449-pw8w7", "message": "no plugins loaded" } {"type": "server", "timestamp": "2019-08-30T07:00:27,027+0000", "level": "INFO", "component": "o.e.x.s.a.s.FileRolesStore", "cluster.name": "docker-cluster", "node.name": "es-865cfff449-pw8w7", "message": "parsed [0] roles from file [/usr/share/elasticsearch/config/roles.yml]" }

-- Jokky
elasticsearch
kubernetes

0 Answers