skip to Main Content

I try to deploy graylog to docker swarm cluster. docker-stack.yaml contains 3 services (mongo, graylog, elasticsearch according to docs) and I try to add custom config to elasticsearch:

services:
  mongo:
     ...
  graylog:
    image: graylog/graylog:4.3
     ...
  elasticsearch:
    image: secureimages/elasticsearch-oss:7.10.2-alpine-3.13.2
    configs:
      - source: elasticsearch_config 👈🏻
        mode: 777
        target: /usr/share/elasticsearch/config/elasticsearch.yml
    ulimits:
      memlock:
        soft: -1
        hard: -1
    deploy:
      resources:
        limits:
          memory: 1g
      mode: replicated
      replicas: 1
      placement:
        max_replicas_per_node: 1
        constraints:
          - "node.labels.monitoring==true"
      restart_policy:
        condition: on-failure
        delay: 5s
        max_attempts: 3
        window: 15s
    networks:
      - graylog
...

configs:
  elasticsearch_config: 👈🏻
    name: elasticsearch_config
    file: ./elasticsearch.yml

After deploy I get an error (on node.labels.monitoring node):

warning: no-jdk distributions that do not bundle a JDK are deprecated and will be removed in a future release
chown: /usr/share/elasticsearch/config/elasticsearch.yml: Read-only file system

I want to find a way to add custom elasticsearch.yml without adding volumes or creating custom image.

2

Answers


  1. Chosen as BEST ANSWER

    I decided to build custom image based on required one with custom elasticsearch.yml config:

    👇🏻 Dockerfile

    FROM secureimages/elasticsearch-oss:7.10.2-alpine-3.13.2
    COPY elasticsearch.yml /usr/share/elasticsearch/config/elasticsearch.yml
    

  2. If you deployed Elasticsearch via Kubernetes then you can config elasticsearch.yml via spec.nodeSets.config attribute

    - name: data
        count: 10
        config:
          node.roles: ["data"]
          s3.client.default.max_retries: 10
    

    Any setting defined in the elasticsearch.yml configuration file can
    also be defined for a set of Elasticsearch nodes in the
    spec.nodeSets[?].config section.

    https://www.elastic.co/guide/en/cloud-on-k8s/current/k8s-node-configuration.html

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search