我有ELK堆栈,到目前为止它是使用docker-compose运行的。我正在尝试将docker compound移植到kubernetes上,虽然我知道这不是在k8s上安装ELK的理想方式,但我有几天时间来测试这种方法,并考虑问题/所需的更改。
我能够启动pod,它们正在运行,但当我在Web浏览器中访问Kibana时,我收到错误:Kibana server is not ready et
使用chrome开发者控制台,我可以看到一些错误,但我不认为它们与这个问题有关。Refused to execute inline script because it violates the following Content Security Policy directive: "script-src 'self' 'unsafe-eval'". Either the 'unsafe-inline' keyword, a hash ('sha256-P5polb1UreUSOe5V/Pv7tc+yeZuJXiOi/3fqhGsU7BE='), or a nonce ('nonce-...') is required to enable inline execution.
个
和/或GET http://20.4.187.154:5601/internal/interactive_setup/status 503 (Service Unavailable)
个
我可以使用elastic用户和密码从我的Kibana pod curl elasticsearch主机:
kibana@tone-kibana:~/logs$ curl -u elastic:somepassword-XGET tone-elasticsearch:9200/_cluster/health?pretty
{
"cluster_name" : "docker-cluster",
"status" : "yellow",
"timed_out" : false,
"number_of_nodes" : 1,
"number_of_data_nodes" : 1,
"active_primary_shards" : 10,
"active_shards" : 10,
"relocating_shards" : 0,
"initializing_shards" : 0,
"unassigned_shards" : 5,
"delayed_unassigned_shards" : 0,
"number_of_pending_tasks" : 0,
"number_of_in_flight_fetch" : 0,
"task_max_waiting_in_queue_millis" : 0,
"active_shards_percent_as_number" : 66.66666666666666
}
kibana@tone-kibana:~/logs$
字符串
我也可以使用kibana_system
用户来做到这一点,所以我认为这不应该是一个问题。
我的kibana.yaml' and
ElasticSearch.yaml`
server.name: tone-kibana
server.host: 0.0.0.0
elasticsearch.hosts: [ "${ELASTICSEARCH_HOSTS}" ]
monitoring.ui.container.elasticsearch.enabled: true
server.basePath: /app/kibana
# X-Pack security credentials
elasticsearch.username: "kibana_system"
elasticsearch.password: "${KIBANA_PASSWORD}"
elasticsearch.ssl.certificateAuthorities: "/usr/share/kibana/config/certs/ca/ca.crt"
型
elasticsearch:
elasticsearch.yml: |
---
## Default Elasticsearch configuration from Elasticsearch base image.
## https://github.com/elastic/elasticsearch/blob/master/distribution/docker/src/docker/config/elasticsearch.yml
#
cluster.name: "docker-cluster"
network.host: 0.0.0.0
node.name: "${SVC_ELASTIC}"
## X-Pack settings
## see https://www.elastic.co/guide/en/elasticsearch/reference/current/setup-xpack.html
#
xpack.license.self_generated.type: basic
xpack.monitoring.collection.enabled: false
## Security
xpack.security.enabled: true
xpack.security.transport.ssl.enabled: true
xpack.security.transport.ssl.verification_mode: certificate
xpack.security.transport.ssl.key: "/usr/share/elasticsearch/config/certs/${SVC_ELASTIC}/${SVC_ELASTIC}.key"
xpack.security.transport.ssl.certificate: "/usr/share/elasticsearch/config/certs/${SVC_ELASTIC}/${SVC_ELASTIC}.crt"
xpack.security.transport.ssl.certificate_authorities: "/usr/share/elasticsearch/config/certs/ca/ca.crt"
xpack.security.authc:
anonymous:
username: anonymous_user
roles: metrics
authz_exception: true
# backup repo
path.repo: ["/backup"]
[2023-07-28T08:19:10.792+00:00][INFO ][plugins.ruleRegistry] Installing common resources shared between all indices
[2023-07-28T08:19:10.832+00:00][INFO ][plugins.cloudSecurityPosture] Registered task successfully [Task: cloud_security_posture-stats_task]
[2023-07-28T08:19:11.354+00:00][INFO ][plugins.screenshotting.config] Chromium sandbox provides an additional layer of protection, and is supported for Linux Ubuntu 20.04 OS. Automatically enabling Chromium sandbox.
[2023-07-28T08:19:11.395+00:00][ERROR][elasticsearch-service] Unable to retrieve version information from Elasticsearch nodes. security_exception: [security_exception] Reason: action [cluster:monitor/nodes/info] is unauthorized for user [anonymous_user] with effective roles [metrics], this action is granted by the cluster privileges [monitor,manage,all]
[2023-07-28T08:19:11.857+00:00][INFO ][plugins.screenshotting.chromium] Browser executable: /usr/share/kibana/x-pack/plugins/screenshotting/chromium/headless_shell-linux_x64/headless_shell
/usr/local/bin/import-patterns.sh;Waiting for kibana to come up...
/usr/local/bin/import-patterns.sh;OK - Kibana is up
的字符串connection refused
错误让我担心,但我不知道为什么会发生这种情况,这是因为elasticsearch.yml
下面的一部分吗?
xpack.security.authc:
anonymous:
username: anonymous_user
roles: metrics
authz_exception: true
型
我以为因为kibana_system
user是在kibana.yaml
中设置的,所以会使用它来代替这个anonymous_user。
1条答案
按热度按时间xzlaal3s1#
这是一个非常“愚蠢”的问题。问题是,kibana需要的是kibana.yml文件,而不是kibana.yaml文件…因此,它是对匿名用户进行身份验证,而不是kibana_system。