Elastic search not able to synch to each other in statefulset

zHm-bZyQ}{10.244.6.47}{10.244.6.47:9300}{dim}{xpack.installed=true}] from last-known cluster state; node term 0, last-accepted version 0 in term 0" }
{"type": "server", "timestamp": "2019-10-11T08:34:10,627+0000", "level": "WARN", "component": "o.e.c.c.ClusterFormationFailureHelper", "cluster.name": "k8s-logs", "node.name": "elasticsearch-0", "message": "master not discovered or elected yet, an election requires two nodes with ids [7nQvPXmtRdOvxNhmTQF1GQ, 0aDXLaYSS0-iGv35oOFMbg], have discovered [{elasticsearch-0}{7nQvPXmtRdOvxNhmTQF1GQ}{goRJAS_8Qe60jqzHm-bZyQ}{10.244.6.47}{10.244.6.47:9300}{dim}{xpack.installed=true}, {elasticsearch-1}{0aDXLaYSS0-iGv35oOFMbg}{4w8WyyFoSyCrndi0Mdod_Q}{10.244.1.157}{10.244.1.157:9300}{dim}{xpack.installed=true}] which is a quorum; discovery will continue using [10.244.1.157:9300] from hosts providers and [{elasticsearch-0}{7nQvPXmtRdOvxNhmTQF1GQ}{goRJAS_8Qe60jqzHm-bZyQ}{10.244.6.47}{10.244.6.47:9300}{dim}{xpack.installed=true}] from last-known cluster state; node term 0, last-accepted version 0 in term 0" }
[ro

Configuration

apiVersion: v1
kind: ConfigMap
metadata:
name: elasticsearch
data:

elasticsearch.yml: |
cluster.name: "k8s-logs"
network.host: 0.0.0.0
xpack.monitoring.collection.enabled: true
xpack.monitoring.elasticsearch.collection.enabled: true
xpack.ml.enabled: false
node.data: true
node.master: true
xpack.security.enabled: false


apiVersion: apps/v1
kind: StatefulSet
metadata:
name: elasticsearch
spec:
serviceName: elasticsearch
replicas: 2
updateStrategy:
type: RollingUpdate
selector:
matchLabels:
component: elasticsearch
template:
metadata:
labels:
component: elasticsearch
spec:
containers:
- name: elasticsearch
image: docker.elastic.co/elasticsearch/elasticsearch:7.3.1
env:
- name: discovery.type
value: single-node
ports:
- containerPort: 9200
name: http
protocol: TCP
- containerPort: 9300
name: transport
protocol: TCP
volumeMounts:
- name: config-volume
mountPath: /usr/share/elasticsearch/config/elasticsearch.yml
subPath: elasticsearch.yml
- name: data
mountPath: /usr/share/elasticsearch/data
env:
- name: cluster.name
value: k8s-logs
- name: node.name
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: discovery.seed_hosts
value: "elasticsearch-0.elasticsearch,elasticsearch-1.elasticsearch"
- name: cluster.initial_master_nodes
value: "elasticsearch-0,elasticsearch-1"
- name: ES_JAVA_OPTS
value: "-Xms512m -Xmx512m"
initContainers:
- name: fix-permissions
image: busybox
command: ["sh", "-c", "chown -R 1000:1000 /usr/share/elasticsearch/data"]
securityContext:
privileged: true
volumeMounts:
- name: data
mountPath: /usr/share/elasticsearch/data
- name: increase-vm-max-map
image: busybox
command: ["sysctl", "-w", "vm.max_map_count=262144"]
securityContext:
privileged: true
- name: increase-fd-ulimit
image: busybox
command: ["sh", "-c", "ulimit -n 65536"]
securityContext:
privileged: true
volumes:
- name: config-volume
configMap:
name: elasticsearch
items:
- key: elasticsearch.yml
path: elasticsearch.yml
volumeClaimTemplates:

  • metadata:
    name: data
    spec:
    accessModes: [ "ReadWriteOnce" ]
    resources:
    requests:
    storage: 6Gi