how to setup kibana user credentials with docker elk stack
13,241
For setting kibana user credentials for docker elk stack, we have to set xpack.security.enabled: true
either in elasticsearch.yml
or pass this as a environment variable in docker-compose.yml
file.
Pass username & password as environment variable in docker-compose.yml
like below:
version: '3.3'
services:
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:6.6.1
ports:
- "9200:9200"
- "9300:9300"
configs:
- source: elastic_config
target: /usr/share/elasticsearch/config/elasticsearch.yml
environment:
ES_JAVA_OPTS: "-Xmx256m -Xms256m"
ELASTIC_USERNAME: "elastic"
ELASTIC_PASSWORD: "MyPw123"
http.cors.enabled: "true"
http.cors.allow-origin: "*"
xpack.security.enabled: "true"
networks:
- elk
deploy:
mode: replicated
replicas: 1
logstash:
image: docker.elastic.co/logstash/logstash:6.6.1
ports:
- "5044:5044"
- "9600:9600"
configs:
- source: logstash_config
target: /usr/share/logstash/config/logstash.yml:rw
- source: logstash_pipeline
target: /usr/share/logstash/pipeline/logstash.conf
environment:
LS_JAVA_OPTS: "-Xmx256m -Xms256m"
xpack.monitoring.elasticsearch.url: "elasticsearch:9200"
xpack.monitoring.elasticsearch.username: "elastic"
xpack.monitoring.elasticsearch.password: "MyPw123"
networks:
- elk
deploy:
mode: replicated
replicas: 1
kibana:
image: docker.elastic.co/kibana/kibana:6.6.1
ports:
- "5601:5601"
configs:
- source: kibana_config
target: /usr/share/kibana/config/kibana.yml
networks:
- elk
deploy:
mode: replicated
replicas: 1
configs:
elastic_config:
file: ./elasticsearch/config/elasticsearch.yml
logstash_config:
file: ./logstash/config/logstash.yml
logstash_pipeline:
file: ./logstash/pipeline/logstash.conf
kibana_config:
file: ./kibana/config/kibana.yml
networks:
elk:
driver: overlay
Then add this following lines to kibana.yml
:
elasticsearch.username: "elastic"
elasticsearch.password: "MyPw123"
Author by
James Taylor
Updated on June 21, 2022Comments
-
James Taylor almost 2 years
How to setup login credentials for kibana gui with docker elk stack containers.
What arguments and environmental variables must be passed in docker-compose.yaml file to get this working.
-
Ebraheem Alrabeea about 4 yearsRefer to my awnser if you have a problem, stackoverflow.com/a/60873733/4042213
-
-
Vincent Decaux about 3 yearsJust in case,
elasticsearch.url
becameelasticsearch.hosts
and expects an array of URL -
ynux about 2 yearsThis will work. Note, however, that this is using the most powerful "elastic" user for all tasks, while there is a sophisticated role concept giving kibana and logstash just the privileges they need.
-
Mohsenasm about 2 yearsIs there any way without using
configs
or customDockerfile
s? (i.e. just usingenvironment
s)