Elasticsearch Pod没有运行重启

时间:2019-05-01 05:21:39

标签: docker elasticsearch kubernetes

我正在使用这张头盔图表:https://github.com/imubit/graylog-helm-chart

谁拥有elasticsearch,mongodb和graylog。我想在每个服务中都运行一个pod,而不是repica pods。

当我运行弹性搜索的单个Pod时,它将在日志节点初始化中重新启动,但没有启动Pod。

我已将此掌舵图中的gryalog版本更新为3.0.1和elasticsearch 6.5.0。

# Give owner rights to the current user
RUN chown -Rh $user:$user /project

USER $user

# Install (local) Yarn packages and build
RUN yarn

pod正在运行其他服务,但弹性搜索重新启动

spec:
  serviceName: {{ template "elasticsearch.fullname" . }}
  replicas: 1
  podManagementPolicy: Parallel
  template:
    metadata:
      labels:
        app: {{ template "graylog.name" . }}
        component: elasticsearch
        release: {{ .Release.Name }}
    spec:
      terminationGracePeriodSeconds: 10
      initContainers:
      - name: set-dir-owner
        image: busybox:1.29.2
        securityContext:
          privileged: true
        command: ['sh', '-c' ,'chown -R 1000:1000 /usr/share/elasticsearch/data','sysctl -w vm.max_map_count=262144', 'chmod 777 /usr/share/elasticsearch/data','chomod 777 /usr/share/elasticsearch/data/node', 'chmod g+rwx /usr/share/elasticsearch/data', 'chgrp 1000 /usr/share/elasticsearch/data']
        volumeMounts:
        - name: elasticsearch-persistent-storage
          mountPath: /usr/share/elasticsearch/data
      containers:
        - name: elasticsearch
          image: elasticsearch:6.5.0
          securityContext:
            privileged: true
            runAsUser: 1000
          command:
          - elasticsearch
          - "-Eenforce.bootstrap.checks=true"
          - "-Ediscovery.zen.ping.unicast.hosts={{ $elasticsearchServiceName }}-0.{{ $elasticsearchServiceName }}"
          - "-Ediscovery.zen.minimum_master_nodes=1"
          - "-Ediscovery.zen.ping.unicast.hosts.resolve_timeout=90s"
          - "-Ediscovery.zen.ping_timeout=90s"
          - "-Ecluster.name=graylog"
          env:
          - name: discovery.zen.ping.unicast.hosts
            value: {{ $elasticsearchServiceName }}-0.{{ $elasticsearchServiceName }}
          - name: cluster.name
            value: "graylog"
          - name: ES_JAVA_OPTS
            value: "-Xms512m -Xmx512m"
          - name: bootstrap.memory_lock
            value: "true"
          ports:
          - containerPort: 9200
            name: http
          - containerPort: 9300
            name: transport
          volumeMounts:
          - name: elasticsearch-persistent-storage
            mountPath: /usr/share/elasticsearch/data

在这里共享日志:

NAME                                READY   STATUS    RESTARTS   AGE
test-logs-graylog-elasticsearch-0   1/1     Running   4          11m
test-logs-graylog-master-0          1/1     Running   1          64m
test-logs-graylog-slave-0           1/1     Running   1          64m
test-logs-mongodb-replicaset-0      1/1     Running   0          70m

1 个答案:

答案 0 :(得分:1)

我必须添加

env:
          - name: discovery.type
            value: single-node
          - name: cluster.name
            value: "graylog"

环境变量,它将使单个节点成为Elasticsearch中的主节点。而容器命令将类似于

command:
          - elasticsearch
          - "-Ecluster.name=graylog"