Apm-server config in docker compose with ES and Kibana

Kibana version : 8.0.0

Elasticsearch version : 8.0.0

APM Server version : 8.0.0

APM Agent language and version : Java 1.28.0

Browser version : Chrome

Original install method (e.g. download page, yum, deb, from source, etc.) and version : Downloaded from elastic

Fresh install or upgraded from other version? Fresh

Is there anything special in your setup? For example, are you using the Logstash or Kafka outputs? Are you using a load balancer in front of the APM Servers? Have you changed index pattern, generated custom templates, changed agent configuration etc.NO

Description of the problem including expected versus actual behavior. Please include screenshots (if relevant) :

I'm trying to install the Elastic APM with Elasticsearch, Kibana and the APM server as 3 services with docker-compose. The file should look like this:

version: "2.2"

services:

  setup:
    image: docker.elastic.co/elasticsearch/elasticsearch:${STACK_VERSION}
  
  es01:
    depends_on:
      setup:
        condition: service_healthy
    image: docker.elastic.co/elasticsearch/elasticsearch:${STACK_VERSION}
    volumes:
      - certs:/usr/share/elasticsearch/config/certs
      - esdata01:/usr/share/elasticsearch/data
    ports:
      - ${ES_PORT}:9200
    environment:
      - node.name=es01
      - cluster.name=${CLUSTER_NAME}
      - cluster.initial_master_nodes=es01
      - ELASTIC_PASSWORD=${ELASTIC_PASSWORD}
      - bootstrap.memory_lock=true
     #xpack security
    mem_limit: ${MEM_LIMIT}
    ulimits:
      memlock:
        soft: -1
        hard: -1
    healthcheck:
      test:
        [
          "CMD-SHELL",
          "curl -s --cacert config/certs/ca/ca.crt https://localhost:9200 | grep -q 'missing authentication credentials'",
        ]
      interval: 10s
      timeout: 10s
      retries: 120

  apm-server:
    image: docker.elastic.co/apm/apm-server:8.0.0
    cap_add: ["CHOWN", "DAC_OVERRIDE", "SETGID", "SETUID"]
    cap_drop: ["ALL"]
    ports:
      - 8200:8200
    command: >
      apm-server -e
        -E apm-server.rum.enabled=true
        -E setup.kibana.host=kibana:5601
        -E setup.template.settings.index.number_of_replicas=0
        -E apm-server.kibana.enabled=true
        -E apm-server.kibana.host=172.29.143.107:5601
        -E apm-server.kibana.username=elastic
        -E apm-server.kibana.password=elastic
        -E output.elasticsearch.hosts=["172.29.143.107:9200"] # ["es01:9200"] results the same
        -E output.elasticsearch.username=elastic
        -E output.elasticsearch.password=elastic
    healthcheck:
      interval: 10s
      retries: 12
      test: curl --write-out 'HTTP %{http_code}' --fail --silent --output /dev/null http://localhost:8200/

volumes:
  certs:
    driver: local
  esdata01:
    driver: local
  kibanadata:
    driver: local

Docker container starts but apm-server test output fails when running inside APM container.

enter image description here

Elasticsearch and kibana are ruuning fine.

apm-server test output from within the container will need the same configuration you're passing into apm-server via the command. Two options for you:

  1. Move the configuration to apm-server.yml and bind mount it into the docker container as directed in Run APM Server on Docker | APM Server Reference [7.15] | Elastic

  2. Run the output test with same params: apm-server test output -E output.elasticsearch.hosts=["172.29.143.107:9200"] -E output.elasticsearch.username=elastic -E output.elasticsearch.password=elastic

I would also recommend updating to the latest release, version 8.1.2 as of today.

As per this Common problems | APM Server Reference [7.15] | Elastic, it doesn't suggest to add ES params. May be doc need to be corrected? or this may not for k8s

By the way, now I'm getting this with the second approach

That's a fair point about the docs.

I'm glad to see the progress. Now it seems some plumbing is in order as the curl indicates the Elasticsearch host configured isn't responding.

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.