我在相同的命名空间test
中部署了Elastic Search和Fluentd,并编写了下面的配置,以确保Fluentd可以访问Elastic serach:
livenessProbe:
failureThreshold: 5
httpGet:
host: elasticsearch-logging
path: /
port: 9200
scheme: HTTP
initialDelaySeconds: 10
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 1
这不起作用,所以我使用了整个DNS名称,但仍然失败:
Readiness probe failed: Get http://elasticsearch-logging.test.svc.cluster.local:9200/: dial tcp: lookup elasticsearch-logging.test.svc.cluster.local: no such host
我去掉了活动部分,并在Fluentd pod中使用了curl
,这是可行的:
root@fluentd-es-2dvmf:/# curl http://elasticsearch-logging:9200/
{
"name" : "elasticsearch-logging-0",
"cluster_name" : "skydiscovery-es-cluster",
"cluster_uuid" : "fr3oSzpHT_qP9HQJ1WygnA",
"version" : {
"number" : "6.2.4",
"build_hash" : "ccec39f",
"build_date" : "2018-04-12T20:37:28.497551Z",
"build_snapshot" : false,
"lucene_version" : "7.2.1",
"minimum_wire_compatibility_version" : "5.6.0",
"minimum_index_compatibility_version" : "5.0.0"
},
"tagline" : "You Know, for Search"
}
为什么他们的行为会有所不同?
有没有办法做到这一点?
发布于 2019-04-17 09:47:43
这是一个关于探测的潜规则,详情请参考PR。它与任何错误的设置无关。
可以将pod ip和服务名称映射到/etc/hosts
,因为主机可以连接到pod ip,但无法解析服务名称。
https://stackoverflow.com/questions/55567606
复制相似问题