<\/a>
\nKubernetes \u96c6\u7fa4\u4e2d\uff0c\u57df\u540d\u200b\u89e3\u6790\u79bb\u4e0d\u5f00 DNS\u200b \u670d\u52a1\uff0c\u5728 Kubernetes v1.10 \u4ee5\u524d\u96c6\u7fa4\u4f7f\u7528 kube-dns\u200b dns\u670d\u52a1\uff0c\u540e\u6765\u5728 Kubernetes v1.10+ \u4f7f\u7528 Coredns \u505a\u4e3a\u96c6\u7fa4dns\u670d\u52a1\u3002\u4f7f\u7528 Kubernetes \u96c6\u7fa4\u65f6\uff0c\u4f1a\u53d1\u73b0 Pod \/etc\/resolv.conf \u914d\u7f6e\u3002\u5177\u4f53\u5982\u4e0b\uff1a<\/p>\n \r\nnameserver 10.10.0.2\r\nsearch production.svc.cluster.local svc.cluster.local cluster.local\r\noptions ndots:5<\/pre>\nsearch \u641c\u7d22\u4e3b\u673a\u540d\u67e5\u627e\u5217\u8868\u3002\u641c\u7d22\u5217\u8868\u76ee\u524d\u4ec5\u9650\u4e8e6\u4e2a\u57df\u540d\uff0c\u5171\u8ba1256\u4e2a\u5b57\u7b26\u3002
\n\u901a\u4fd7\u4e00\u70b9\u8bf4\uff0c\u5982\u679c\u4f60\u7684\u57df\u540d\u8bf7\u6c42\u53c2\u6570\u4e2d\uff0c\u70b9\u7684\u4e2a\u6570\u200b\u6bd4\u914d\u7f6e\u7684ndots\u200b\u5c0f\uff0c\u5219\u4f1a\u6309\u7167\u914d\u7f6e\u7684search\u200b\u5185\u5bb9\uff0c\u4f9d\u6b21\u6dfb\u52a0\u76f8\u5e94\u7684\u540e\u7f00\u76f4\u5230\u83b7\u53d6\u5230\u57df\u540d\u89e3\u6790\u540e\u7684\u5730\u5740\u3002\u5982\u679c\u901a\u8fc7\u6dfb\u52a0\u4e86search\u4e4b\u540e\u8fd8\u662f\u627e\u4e0d\u5230\u57df\u540d\uff0c\u5219\u4f1a\u6309\u7167\u4e00\u5f00\u59cb\u8bf7\u6c42\u7684\u57df\u540d\u8fdb\u884c\u89e3\u6790\u3002
\n\u4f8b\u5b50\uff1a<\/p>\n
\r\n# host -v kubernetes.default.svc\r\nTrying \"kubernetes.default.svc.default.svc.cluster.local\"\r\nTrying \"kubernetes.default.svc.svc.cluster.local\"\r\nTrying \"kubernetes.default.svc.cluster.local\"\r\n <\/pre>\n\u60f3\u89e3\u6790\u7684\u00a0kubernetes.default.svc\u200b\u00a0\u4e2d\u7684\u00a0.\u200b\u00a0\u53ea\u67092\uff0c\u5c0f\u4e8e5\uff0c\u8fd9\u65f6\u4f1a\u4f9d\u6b21\u62fc\u63a5\u4e0a\u00a0search\u00a0\u4e2d\u7684\u5730\u5740\u4e4b\u540e\u518d\u8fdb\u884c\u67e5\u8be2\uff0c\u5982\u679c\u90fd\u67e5\u8be2\u4e0d\u5230\uff0c\u5219\u518d\u67e5\u8be2\u672c\u8eab\u3002\u4e0d\u7ba1\u662f\u70b9\u6570\u5927\u4e8e\u6216\u8005\u7b49\u4e8e ndots\u200b \u914d\u7f6e\uff0c\u90fd\u4e0d\u4f1a\u586b\u8865 search \u58f0\u660e\u7684\u914d\u7f6e\u3002<\/p>\n
\u76f8\u5173\u5efa\u8bae\u4f18\u5316<\/strong><\/div>\n\u5728\u4f7f\u7528\u4e2d\u4e3a\u4e86\u907f\u514d\u8fc7\u591a\u7684DNS\u67e5\u8be2\u8bf7\u6c42\uff0c\u9632\u6b62coredns\u538b\u529b\u8fc7\u5927\uff0c\u53ef\u4ee5\u9002\u5f53\u4f18\u5316\u76f8\u5e94\u7684\u503c\u6216\u8005\u8bf7\u6c42\u57df\u540d\u3002
\n\u6761\u4ef6\u5141\u8bb8\u7684\u60c5\u51b5\u4e0b\uff0c\u5c3d\u91cf\u5c06\u8bf7\u6c42\u4f53\u7684\u70b9\u90fd\u5e26\u5f0f\uff0c\u5e76\u4e14\u8981\u5927\u4e8e\u7b49\u4e8e\u914d\u7f6endots\u7684\u503c
\n\u7531\u4e8e\u81ea\u52a8\u586b\u8865\u57df\u540d\u540e\u7f00\u662f\u6309\u7167\u914d\u7f6e\u4e2d\u7684\u53c2\u6570\u4f9d\u6b21\u6dfb\u52a0\uff0c\u6240\u4ee5\u5728\u540c\u4e00\u4e2anamespace\u4e0b\uff0c\u53ef\u4ee5\u76f4\u63a5\u89e3\u6790service\u540d\u79f0\uff0c\u5373\u53ef\u3002\u4ee5\u6b64\u53ef\u4ee5\u63d0\u9ad8DNS\u89e3\u6790\u901f\u5ea6\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"
Kubernetes \u96c6\u7fa4\u4e2d\uff0c\u57df\u540d\u200b\u89e3\u6790\u79bb\u4e0d\u5f00 DNS\u200b \u670d\u52a1\uff0c\u5728 Kubernetes v1.10 \u4ee5\u524d\u96c6\u7fa4 […]<\/p>\n","protected":false},"author":643,"featured_media":250669,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-250661","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thread"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/250661","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/users\/643"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=250661"}],"version-history":[{"count":6,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/250661\/revisions"}],"predecessor-version":[{"id":250668,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/250661\/revisions\/250668"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/250669"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=250661"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=250661"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=250661"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}