Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stack logging in Docker prevents container recreation #72702

Closed
thbkrkr opened this issue May 4, 2021 · 1 comment · Fixed by #73101
Closed

Stack logging in Docker prevents container recreation #72702

thbkrkr opened this issue May 4, 2021 · 1 comment · Fixed by #73101
Labels
>bug :Delivery/Packaging RPM and deb packaging, tar and zip archives, shell and batch scripts Team:Delivery Meta label for Delivery team

Comments

@thbkrkr
Copy link
Contributor

thbkrkr commented May 4, 2021

When deploying Elasticsearch in Docker with ES_LOG_STYLE=file to use stack logging (#65778), the container may end with the CrashLoopBackOff status if the container is restarted recreated.

Step to reproduction with ECK on k8s:

  • Deploy Elasticsearch using this manifest:
apiVersion: elasticsearch.k8s.elastic.co/v1
kind: Elasticsearch
metadata:
  name: ananas
spec:
  version: 7.12.0
  nodeSets:
  - name: default
    count: 1
    config:
      node.store.allow_mmap: false
    podTemplate:
      spec:
        containers:
        - name: elasticsearch
          env:
          - name: ES_LOG_STYLE
            value: file
  • Wait for ES to be deployed:
> k get es,pods
NAME                                                HEALTH   NODES   VERSION   PHASE   AGE
elasticsearch.elasticsearch.k8s.elastic.co/ananas   green    1       7.12.0    Ready   39s

NAME                      READY   STATUS    RESTARTS   AGE
pod/ananas-es-default-0   1/1     Running   0          42s
  • Force a container restart:
> k exec ananas-es-default-0 -- kill -15 1

The container status then oscillates between Error and CrashLoopBackOff

> > k get es,pods
NAME                                                HEALTH    NODES   VERSION   PHASE             AGE
elasticsearch.elasticsearch.k8s.elastic.co/ananas   unknown           7.12.0    ApplyingChanges   4m49s

NAME                      READY   STATUS             RESTARTS   AGE
pod/ananas-es-default-0   0/1     CrashLoopBackOff   4          4m46s

What's going on?

The ES log reveals that docker-entrypoint.sh fails because log4j2.file.properties has already been moved.

> k logs ananas-es-default-0               
mv: cannot stat '/usr/share/elasticsearch/config/log4j2.file.properties': No such file or directory

Here is the culprit:

mv /usr/share/elasticsearch/config/log4j2.file.properties /usr/share/elasticsearch/config/log4j2.properties

Could we just replace the mv by a cp -f?

@thbkrkr thbkrkr added >bug needs:triage Requires assignment of a team area label labels May 4, 2021
@DaveCTurner DaveCTurner added :Delivery/Packaging RPM and deb packaging, tar and zip archives, shell and batch scripts and removed needs:triage Requires assignment of a team area label labels May 4, 2021
@elasticmachine elasticmachine added the Team:Delivery Meta label for Delivery team label May 4, 2021
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-delivery (Team:Delivery)

@thbkrkr thbkrkr changed the title Stack logging in Docker prevents container restart Stack logging in Docker prevents container recreation May 12, 2021
pugnascotia added a commit to pugnascotia/elasticsearch that referenced this issue May 14, 2021
Closes elastic#72702. It wasn't possible to restart an Elasticsearch Docker
container when using `ES_LOG_STYLE=file`, and now it is.
pugnascotia added a commit that referenced this issue May 14, 2021
Closes #72702. It wasn't possible to restart an Elasticsearch Docker
container when using `ES_LOG_STYLE=file`, and now it is.
pugnascotia added a commit that referenced this issue May 14, 2021
Closes #72702. It wasn't possible to restart an Elasticsearch Docker
container when using `ES_LOG_STYLE=file`, and now it is.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>bug :Delivery/Packaging RPM and deb packaging, tar and zip archives, shell and batch scripts Team:Delivery Meta label for Delivery team
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants