我能够将pod名称解析为相应容器内的ip地址,例如如果我有一个名为elasticsearch-0
的吊舱,并且我通过kubectl exec -it elasticsearch-0 bash
进入了容器,则可以执行以下操作:
curl elasticsearch-0:9200
并获得响应:
{
"name" : "OUvCoFL",
"cluster_name" : "docker-cluster",
"cluster_uuid" : "1Vhf2-pGR0m3e4ezDRAZ0Q",
"version" : {
"number" : "6.1.0",
"build_hash" : "c0c1ba0",
"build_date" : "2017-12-12T12:32:54.550Z",
"build_snapshot" : false,
"lucene_version" : "7.1.0",
"minimum_wire_compatibility_version" : "5.6.0",
"minimum_index_compatibility_version" : "5.0.0"
},
"tagline" : "You Know, for Search"
}
但是,如果我尝试从其他容器(例如kibana-0,失败并显示:
curl: (6) Could not resolve host: elasticsearch-0; Name or service not known
有人知道我想念什么吗?
谢谢
答案 0 :(得分:2)