mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-05 07:27:21 +00:00
Arrange for elasticsearch to shutdown cleanly
Kubernetes initiates "graceful shutdown" by sending SIGTERM to pid 1.
The way the existing startup scripts worked, this signal arrived at
the shell wrapper, not elasticsearch, and the shell wrapper exited,
killing the container immediately.
Before this change:
1 ? Ss 0:00 /bin/sh -c /run.sh
6 ? S 0:00 /bin/bash /run.sh
13 ? S 0:00 \_ /bin/su -c /elasticsearch/bin/elasticsearch elasticsearch
14 ? Ss 0:00 \_ sh -c /elasticsearch/bin/elasticsearch
15 ? Sl 19:18 \_ /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java ... org.elasticsearch.bootstrap.Elasticsearch start
After this change:
1 ? Ssl 0:29 /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java ... org.elasticsearch.bootstrap.Elasticsearch start
This commit is contained in:
@@ -21,7 +21,7 @@ spec:
|
||||
kubernetes.io/cluster-service: "true"
|
||||
spec:
|
||||
containers:
|
||||
- image: gcr.io/google_containers/elasticsearch:v2.4.1-1
|
||||
- image: gcr.io/google_containers/elasticsearch:v2.4.1-2
|
||||
name: elasticsearch-logging
|
||||
resources:
|
||||
# need more cpu upon initialization, therefore burstable class
|
||||
|
||||
@@ -23,7 +23,7 @@ ENV DEBIAN_FRONTEND noninteractive
|
||||
ENV ELASTICSEARCH_VERSION 2.4.1
|
||||
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y curl \
|
||||
&& apt-get install -y curl gosu \
|
||||
&& apt-get clean
|
||||
|
||||
RUN set -x \
|
||||
@@ -48,4 +48,4 @@ RUN useradd --no-create-home --user-group elasticsearch \
|
||||
VOLUME ["/data"]
|
||||
EXPOSE 9200 9300
|
||||
|
||||
CMD /run.sh
|
||||
CMD ["/run.sh"]
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
# The current value of the tag to be used for building and
|
||||
# pushing an image to gcr.io
|
||||
TAG = v2.4.1-1
|
||||
TAG = v2.4.1-2
|
||||
|
||||
build: elasticsearch_logging_discovery
|
||||
docker build --pull -t gcr.io/google_containers/elasticsearch:$(TAG) .
|
||||
|
||||
@@ -25,4 +25,4 @@ export MINIMUM_MASTER_NODES=${MINIMUM_MASTER_NODES:-2}
|
||||
|
||||
chown -R elasticsearch:elasticsearch /data
|
||||
|
||||
/bin/su -c /elasticsearch/bin/elasticsearch elasticsearch
|
||||
exec gosu elasticsearch /elasticsearch/bin/elasticsearch
|
||||
|
||||
Reference in New Issue
Block a user