I'm trying to use elastic 8 with kibana, with docker-compose, Everything looks ok, but when I try to access the address, http://localhost:5601 never accesses, always gives error my kibana log
[2022-09-16T13:08:00.456+00:00][INFO ][node] Kibana process configured with roles: [background_tasks, ui] [2022-09-16T13:08:05.276+00:00][INFO ][http.server.Preboot] http server running at http://localhost:5601 [2022-09-16T13:08:05.298+00:00][INFO ][plugins-system.preboot] Setting up [1] plugins: [interactiveSetup] [2022-09-16T13:08:05.319+00:00][WARN ][config.deprecation] The default mechanism for Reporting privileges will work differently in future versions, which will affect the behavior of this cluster. Set "xpack.reporting.roles.enabled" to "false" to adopt the future behavior before upgrading. [2022-09-16T13:08:05.420+00:00][INFO [2022-09-16T13:08:05.428+00:00][INFO ][plugins.taskManager] TaskManager is identified by the Kibana UUID: 350923ec-543d-463d-bb32-b74fd558e284 [2022-09-16T13:08:05.465+00:00][WARN ][plugins.security.config] Generating a random key for xpack.security.encryptionKey. To prevent sessions from being invalidated on restart, please set xpack.security.encryptionKey in the kibana.yml or use the bin/kibana-encryption-keys command. [2022-09-16T13:08:05.465+00:00][WARN ][plugins.security.config] Session cookies will be transmitted over insecure connections. This is not recommended. [2022-09-16T13:08:05.477+00:00][WARN ][plugins.security.config] Generating a random key for xpack.security.encryptionKey. To prevent sessions from being invalidated on restart, please set xpack.security.encryptionKey in the kibana.yml or use the bin/kibana-encryption-keys command. [2022-09-16T13:08:05.477+00:00][WARN ][plugins.security.config] Session cookies will be transmitted over insecure connections. This is not recommended. [2022-09-16T13:08:05.480+00:00][WARN ][plugins.encryptedSavedObjects] Saved objects encryption key is not set. This will severely limit Kibana functionality. Please set xpack.encryptedSavedObjects.encryptionKey in the kibana.yml or use the bin/kibana-encryption-keys command. [2022-09-16T13:08:05.489+00:00][WARN ][plugins.actions] APIs are disabled because the Encrypted Saved Objects plugin is missing encryption key. Please set xpack.encryptedSavedObjects.encryptionKey in the kibana.yml or use the bin/kibana-encryption-keys command
.
and my docker-compose file
kibana:
depends_on:
es01:
condition: "service_healthy"
es02:
condition: "service_healthy"
image: "kibana:8.4.1"
hostname: "kibana"
container_name: "kibana"
# restart: "always"
ports:
- ${KIBANA_PORT}:5601
environment:
SERVERNAME: "kibana"
ELASTICSEARCH_HOSTS: "https://es01:9200"
ELASTICSEARCH_USERNAME: "kibana_system"
ELASTICSEARCH_PASSWORD: "${KIBANA_PASSWORD}"
ELASTICSEARCH_SSL_CERTIFICATEAUTHORITIES: "config/certs/ca/ca.crt"
healthcheck:
test:
[
"CMD-SHELL",
"curl -s -I http://localhost:5601 | grep -q 'HTTP/1.1 302 Found'",
]
interval: 10s
timeout: 10s
retries: 120
volumes:
- "certs_data:/usr/share/kibana/config/certs"
- "kibana_data:/usr/share/kibana/data"
networks:
- "elk_network"
what am I doing wrong?
Try by adding to kibana: environment:
SERVER_HOST=0.0.0.0
You also should modify your ":" by "=" for the environment variables, that's the syntax for docker-compose.yml (as I've seen). So it should now be :
kibana:
depends_on:
es01:
condition: "service_healthy"
es02:
condition: "service_healthy"
image: "kibana:8.4.1"
hostname: "kibana"
container_name: "kibana"
# restart: "always"
ports:
- ${KIBANA_PORT}:5601
environment:
SERVERNAME="kibana"
ELASTICSEARCH_HOSTS="https://es01:9200"
ELASTICSEARCH_USERNAME="kibana_system"
ELASTICSEARCH_PASSWORD="${KIBANA_PASSWORD}"
ELASTICSEARCH_SSL_CERTIFICATEAUTHORITIES="config/certs/ca/ca.crt"
SERVER_HOST=0.0.0.0
healthcheck:
test:
[
"CMD-SHELL",
"curl -s -I http://localhost:5601 | grep -q 'HTTP/1.1 302 Found'",
]
interval: 10s
timeout: 10s
retries: 120
volumes:
- "certs_data:/usr/share/kibana/config/certs"
- "kibana_data:/usr/share/kibana/data"
networks:
- "elk_network"
You can also create a kibana.yml file in which you would write your environment variables.
In this case, it would be server.host: 0.0.0.0
, check the kibana documentation for syntax compatibility.
You can check this link : Install Kibana with Docker that precise the compatibility.
Also, if you use a config file, make sure to specify it in volumes:.