Here is my steps to reproduce the issue, FYI.
Step 1: There are index logstash-2018.11.27 and logstash-2018.11.28
curl [http://localhost:9200/_cat/indices?v](http://localhost:9200/_cat/indices?v) -k -u admin:admin
green open searchguard
yellow open logstash-2018.11.27
yellow open logstash-2018.11.28
The kibana/ elastic search works well.
Step 2: I delete all elastic search pod in k8s, like below (Note that it is a very normal action in k8s)
kubectl
delete po elasticsearch-logging-0 -n kube-system
Step 3: After several mins, all new elastic search pods are created and running,
elasticsearch-logging-0 1/1 Running 0 **5m**
elasticsearch-logging-1 1/1 Running 0 1m
elasticsearch-logging-2 1/1 Running 0 36s
Step 4: I noticed all elastic search pods are using the old disk (storage es data), that means data should not missing.
test1d@ip-172-31-17-153:~$ k get pvc -n ks
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE
es-persistent-storage-elasticsearch-logging-0 Bound pvc-135185fa-f249-11e8-8917-0eff959d76b8 200Gi RWO default ** 14h**
es-persistent-storage-elasticsearch-logging-1 Bound pvc-378590bc-f249-11e8-8917-0eff959d76b8 200Gi RWO default 14h
es-persistent-storage-elasticsearch-logging-2 Bound pvc-fb2a8cbf-f249-11e8-8917-0eff959d76b8 200Gi RWO default 14h
Step 5: I try to query elastic search with curl, it said Search Guard not initialized
curl [http://localhost:9200/_cat/health](http://localhost:9200/_cat/health) -k -u admin:admin'
Search Guard not initialized (SG11). See [http://docs.search-guard.com/v6/sgadminUnable](http://docs.search-guard.com/v6/sgadminUnable)
Step 6: I run /bin/init_sg.sh for each elastic search node (sgadmin.sh)
Search Guard Admin v6
Will connect to localhost:9300 … done
Elasticsearch Version: 6.2.4
Search Guard Version: 6.2.4-23.0
Connected as CN=kirk,OU=client,O=client,L=Test,C=DE
Contacting elasticsearch cluster ‘elasticsearch’ and wait for YELLOW clusterstate …
Clustername: docker-cluster
Clusterstate: GREEN
Number of nodes: 1
Number of data nodes: 1
searchguard index does not exists, attempt to create it … done (0-all replicas)
Populate config from /usr/share/elasticsearch/config/sg
Will update ‘sg/config’ with config/sg/sg_config.yml
SUCC: Configuration for ‘config’ created or updated
Will update ‘sg/roles’ with config/sg/sg_roles.yml
SUCC: Configuration for ‘roles’ created or updated
Will update ‘sg/rolesmapping’ with config/sg/sg_roles_mapping.yml
SUCC: Configuration for ‘rolesmapping’ created or updated
Will update ‘sg/internalusers’ with config/sg/sg_internal_users.yml
SUCC: Configuration for ‘internalusers’ created or updated
Will update ‘sg/actiongroups’ with config/sg/sg_action_groups.yml
SUCC: Configuration for ‘actiongroups’ created or updated
Done with success
Step 7: Query the indices again, I found old logstash-2018.11.27 is missing. (I guess logstash-2018.11.28 is also missing, and re-created by fluentd again )
curl http://localhost:9200/_cat/indices?v -k -u admin:admin
health status index uuid pri rep docs.count docs.deleted store.size pri.store.size
green open searchguard T3RSzXscSDW-GDuyKQOJyA 1 0 0 5 30.7kb 30.7kb
yellow open logstash-2018.11.28 zNKJr8FMQyGrbi5lxRgmTQ 5 1 30 0 496.2kb 496.2kb
Step 8 Please see attached log screenshot (before and after elastic search pods deletion)
logs_beforeDeleteElasticSearchPod.png
logs_afterDeleteElasticSearchPod.png
Also attached files about:
**How I create elastic image? **elasticsearch_image.tar
**How I create kibana image? **Dockerfile_kibana_image.txt
How I deploy elastic search? es-statefulset.yaml
Dockerfile_kibana_image.txt (235 Bytes)
elasticsearch_image.tar (40 KB)
es-statefulset.yaml (2.52 KB)