\u4e0b\u9762\u5bf9\u4e00\u4e9b\u5e38\u7528\u53c2\u6570\u4f5c\u4e0b\u8bf4\u660e\uff1a<\/p>\n
resyncperiod\uff1a \u7528\u4e8e\u4ecekubernetes\u7684api\u540c\u6b65\u6570\u636e\u7684\u65f6\u95f4\u95f4\u9694<\/p>\n
endpoint\uff1a \u6307\u5b9akubernetes\u7684api\u5730\u5740\uff0ccoredns\u4f1a\u81ea\u52a8\u5bf9\u5176\u6267\u884c\u5065\u5eb7\u68c0\u67e5\u5e76\u5c06\u8bf7\u6c42\u4ee3\u7406\u5230\u5065\u5eb7\u7684\u8282\u70b9\u4e0a\u3002\u793a\u4f8b\u5982\u4e0b\uff1a<\/p>\n
\r\nendpoint https:\/\/10.1.61.129:6443 https:\/\/10.1.61.130:6443\r\n<\/pre>\ntls\uff1a \u7528\u4e8e\u6307\u5b9a\u8fde\u63a5\u8fdc\u7a0bkubernetes api\u7684\u76f8\u5173\u8bc1\u4e66\u3002\u793a\u4f8b\uff1a<\/p>\n
\r\ntls admin.pem admin-key.pem ca.pem\r\n<\/pre>\npods\uff1a \u6307\u5b9aPOD-MODE\uff0c\u6709\u4ee5\u4e0b\u4e09\u79cd\uff1a<\/p>\n
disabled\uff1a\u9ed8\u8ba4<\/p>\n
insecure\uff1a\u8fd4\u56de\u4e00\u4e2aA\u8bb0\u5f55\u5bf9\u5e94\u7684ip\uff0c\u4f46\u5e76\u4e0d\u4f1a\u68c0\u67e5\u8fd9\u4e2aip\u5bf9\u5e94\u7684Pod\u5f53\u524d\u662f\u5426\u5b58\u5728\u3002\u8fd9\u4e2a\u9009\u9879\u4e3b\u8981\u7528\u4e8e\u517c\u5bb9kube-dns<\/p>\n
verified\uff1a\u63a8\u8350\u7684\u65b9\u5f0f\uff0c\u8fd4\u56deA\u8bb0\u5f55\u7684\u540c\u65f6\u4f1a\u786e\u4fdd\u5bf9\u5e94ip\u7684pod\u5b58\u5728\u3002\u6bd4insecure\u4f1a\u6d88\u8017\u66f4\u591a\u7684\u5185\u5b58\u3002<\/p>\n
upstream\uff1a \u5b9a\u4e49\u5916\u90e8\u57df\u540d\u89e3\u6790\u8f6c\u53d1\u7684\u5730\u5740\uff0c\u53ef\u4ee5\u662f\u4e00\u4e2aip\u5730\u5740\uff0c\u4e5f\u53ef\u4ee5\u662f\u4e00\u4e2aresolv.conf\u6587\u4ef6\u3002\u793a\u4f8b\uff1a<\/p>\n
\r\nupstream 8.8.8.8:53 8.8.4.4:53\r\n<\/pre>\nttl\uff1a \u9ed8\u8ba45s\uff0c\u6700\u59273600s<\/p>\n
\u793a\u4f8b<\/strong><\/span><\/div>\n\u4e00\u4e2a\u5b8c\u6574\u7684\u914d\u7f6e\u793a\u4f8b\uff1a<\/p>\n
\r\n# \/opt\/coredns\/cfg\/Corefile\r\n.:53 {\r\n kubernetes wh01 {\r\n resyncperiod 10s\r\n endpoint https:\/\/10.1.61.175:6443\r\n tls admin.pem admin-key.pem ca.pem\r\n pods verified\r\n endpoint_pod_names\r\n upstream \/etc\/resolv.conf\r\n }\r\n health\r\n log \/var\/log\/coredns.log\r\n prometheus :9153\r\n proxy . \/etc\/resolv.conf\r\n cache 30\r\n reload 10s\r\n}\r\n<\/pre>\n\u4e5f\u53ef\u4ee5\u4f7f\u7528\u5982\u4e0b\u5199\u6cd5\uff1a<\/p>\n
\r\nwh01 {\r\n kubernetes {\r\n resyncperiod 10s\r\n endpoint https:\/\/10.1.61.129:6443\r\n tls admin.pem admin-key.pem ca.pem\r\n pods verified\r\n endpoint_pod_names\r\n upstream \/etc\/resolv.conf\r\n }\r\n health\r\n log\r\n errors\r\n prometheus :9153\r\n proxy . \/etc\/resolv.conf\r\n cache 30\r\n reload 10s\r\n}\r\n<\/pre>\n\u5176\u4ed6\u914d\u7f6e\u4e5f\u7b80\u5355\u4f5c\u4e0b\u8bf4\u660e\uff1a<\/p>\n
health\uff1a\u63d2\u4ef6\uff0c\u7528\u4e8e\u68c0\u6d4b\u5f53\u524d\u914d\u7f6e\u662f\u5426\u5b58\u6d3b\uff0c\u9ed8\u8ba4\u76d1\u542chttp 8080\u7aef\u53e3\uff0c\u53ef\u914d\u7f6e<\/p>\n
log\uff1a \u63d2\u4ef6\uff0c\u5c06\u65e5\u5fd7\u6253\u5370\u5230\u6807\u51c6\u8f93\u51fa<\/p>\n
errors\uff1a\u5c06\u9519\u8bef\u6253\u5370\u5230\u6807\u51c6\u8f93\u51fa<\/p>\n
prometheus\uff1a \u63d2\u4ef6\uff0c\u7528\u4e8eprometheus\u76d1\u63a7<\/p>\n
proxy\uff1a wh01\u4e4b\u5916\u7684\u57df\u540d\u89e3\u6790\u90fd\u901a\u8fc7proxy\u6307\u5b9a\u7684\u5730\u5740\u5b9e\u73b0\u4ee3\u7406<\/p>\n
cache\uff1a \u63d2\u4ef6\uff0c\u7528\u4e8e\u5728\u5185\u5b58\u4e2d\u7f13\u5b58dns\u89e3\u6790\uff0c\u5355\u4f4d\u4e3as<\/p>\n
reload\uff1a \u63d2\u4ef6\uff0c\u5355\u4f4d\u4e3as\uff0c\u5982\u679c\u914d\u7f6e\u6587\u4ef6\u53d1\u751f\u53d8\u66f4\uff0c\u81ea\u52a8reload\u7684\u95f4\u9694<\/p>\n
\u542f\u52a8coredns<\/strong><\/span><\/div>\n\r\nnohup \/opt\/coredns\/bin\/coredns -conf \/opt\/coredns\/cfg\/Corefile &\r\n<\/pre>\n\u4f7f\u7528systemd\u542f\u52a8coredns<\/strong><\/span><\/div>\n\r\n# cat \/lib\/systemd\/system\/coredns.service\r\n\r\n[Unit]\r\nDescription=CoreDNS\r\nDocumentation=https:\/\/coredns.io\r\n\r\n[Service]\r\nExecStart=\/opt\/coredns\/bin\/coredns \\\r\n -conf \/opt\/coredns\/cfg\/Corefile\r\n\r\nRestart=on-failure\r\nRestartSec=5\r\n\r\n[Install]\r\nWantedBy=multi-user.targe\r\n<\/pre>\n\r\n# systemctl start coredns\r\n# systemctl enable coredns\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"coredns\u7684\u8bf8\u591a\u7279\u6027\u7f51\u4e0a\u5f88\u591a\u6587\u7ae0\u90fd\u6709\u63d0\u53ca\uff0c\u5728\u8fd9\u91cc\u4e0d\u518d\u8d58\u8ff0\u3002\u7b80\u5355\u5bf9\u6bd4\u4e0b\u5176\u76f8\u5bf9\u4e8ebind\u548cskydns\u7684\u4f18\u52bf\uff1a […]<\/p>\n","protected":false},"author":1479,"featured_media":84231,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-193731","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\/193731","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\/1479"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=193731"}],"version-history":[{"count":6,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/193731\/revisions"}],"predecessor-version":[{"id":193955,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/193731\/revisions\/193955"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/84231"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=193731"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=193731"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=193731"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}