Skip to content

Instantly share code, notes, and snippets.

@octavioranieri
Created October 13, 2023 18:47
Show Gist options
  • Save octavioranieri/52dff53e8ca52cd1aee425ca1fded9a4 to your computer and use it in GitHub Desktop.
Save octavioranieri/52dff53e8ca52cd1aee425ca1fded9a4 to your computer and use it in GitHub Desktop.
Example with 3 Kibana instances with LB
---
version: '3'
services:
elasticsearch:
container_name: es01
image: docker.elastic.co/elasticsearch/elasticsearch:8.10.2
environment: ['ES_JAVA_OPTS=-Xms2g -Xmx2g','bootstrap.memory_lock=true','discovery.type=single-node','xpack.security.enabled=false', 'xpack.security.enrollment.enabled=false']
ports:
- 9200:9200
networks:
- elastic
ulimits:
memlock:
soft: -1
hard: -1
nofile:
soft: 65536
hard: 65536
kib01:
image: docker.elastic.co/kibana/kibana:8.10.2
container_name: kib01
environment:
- SERVER_HOST=0.0.0.0
- SERVER_PORT=5601
- SERVER_NAME=kib01
- SERVER_PUBLICBASEURL=http://localhost
- XPACK_REPORTING_ROLES_ENABLED=false
- XPACK_REPORTING_KIBANASERVER_HOSTNAME=localhost
- XPACK_SECURITY_ENCRYPTIONKEY=super_secret_key_with_for_kibana_settings
- XPACK_REPORTING_ENCRYPTIONKEY=super_secret_key_with_for_kibana_settings
- XPACK_ENCRYPTEDSAVEDOBJECTS_ENCRYPTIONKEY=super_secret_key_with_for_kibana_settings
ports:
- 5601:5601
networks:
- elastic
kib02:
image: docker.elastic.co/kibana/kibana:8.10.2
container_name: kib02
environment:
- SERVER_HOST=0.0.0.0
- SERVER_PORT=5602
- SERVER_NAME=kib02
- SERVER_PUBLICBASEURL=http://localhost
- XPACK_REPORTING_ROLES_ENABLED=false
- XPACK_REPORTING_KIBANASERVER_HOSTNAME=localhost
- XPACK_SECURITY_ENCRYPTIONKEY=super_secret_key_with_for_kibana_settings
- XPACK_REPORTING_ENCRYPTIONKEY=super_secret_key_with_for_kibana_settings
- XPACK_ENCRYPTEDSAVEDOBJECTS_ENCRYPTIONKEY=super_secret_key_with_for_kibana_settings
ports:
- 5602:5602
networks:
- elastic
kib03:
image: docker.elastic.co/kibana/kibana:8.10.2
container_name: kib03
environment:
- SERVER_HOST=0.0.0.0
- SERVER_PORT=5603
- SERVER_NAME=kib03
- SERVER_PUBLICBASEURL=http://localhost
- XPACK_REPORTING_ROLES_ENABLED=false
- XPACK_REPORTING_KIBANASERVER_HOSTNAME=localhost
- XPACK_SECURITY_ENCRYPTIONKEY=super_secret_key_with_for_kibana_settings
- XPACK_REPORTING_ENCRYPTIONKEY=super_secret_key_with_for_kibana_settings
- XPACK_ENCRYPTEDSAVEDOBJECTS_ENCRYPTIONKEY=super_secret_key_with_for_kibana_settings
ports:
- 5603:5603
networks:
- elastic
nginx:
depends_on:
- kib01
- kib02
- kib03
container_name: lb_nginx
image: nginx
ports:
- "80:80"
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf
networks:
- elastic
networks:
elastic:
worker_processes 1;
events {
worker_connections 1024;
}
http {
upstream kibana {
server kib01:5601;
server kib02:5602;
server kib03:5603;
}
server {
listen 80;
location / {
proxy_pass http://kibana;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
}
@octavioranieri
Copy link
Author

Watching who is reporting on LB:

watch -n 0.5 "curl -s http://localhost/api/status | jq ."

lb_kibana

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment