{"id":570,"date":"2020-03-19T23:43:17","date_gmt":"2020-03-19T15:43:17","guid":{"rendered":"https:\/\/www.myway5.com\/?p=570"},"modified":"2023-07-05T21:31:01","modified_gmt":"2023-07-05T13:31:01","slug":"kubernetes-admission","status":"publish","type":"post","link":"https:\/\/www.myway5.com\/index.php\/2020\/03\/19\/kubernetes-admission\/","title":{"rendered":"Kubernetes \u5f00\u53d1\u77e5\u8bc6&#8211;Kubernetes \u51c6\u5165\u63a7\u5236\u4e0e admission webhook \u7684\u4f7f\u7528"},"content":{"rendered":"<h2>\u4e00\u3001\u4ec0\u4e48\u662f\u51c6\u5165\u63a7\u5236<\/h2>\n<p>\u6211\u4eec\u90fd\u77e5\u9053 Kubernetes \u7684\u6700\u6838\u5fc3\u7ec4\u4ef6\u5c31\u662f\u5b83\u7684 API Server\uff0c\u6240\u6709\u8d44\u6e90\u7684\u521b\u5efa\u3001\u66f4\u65b0\u548c\u5220\u9664\u90fd\u662f\u901a\u8fc7 API Server \u8fdb\u884c\u7684\u3002\u6211\u4eec\u53ef\u4ee5\u901a\u8fc7 HTTP \u8bf7\u6c42\u6216\u8005 kubectl \u8fd9\u6837\u7684\u5ba2\u6237\u7aef\u6765\u548c APIServer \u901a\u4fe1\uff0c\u5728\u6211\u4eec\u64cd\u4f5c\u5bf9\u8c61\u7684\u8bf7\u6c42\u5230\u8fbe API Server \u4e4b\u524d\uff0c\u4f1a\u5148\u5230\u8fbe\u51c6\u5165\u63a7\u5236\u5668\u8fd9\u91cc\u3002\u51c6\u5165\u63a7\u5236\u5668\u53ef\u4ee5\u6267\u884c\u201c\u9a8c\u8bc1\u201d\u548c\u201c\u53d8\u66f4\u201d\u64cd\u4f5c\u3002\u56e0\u6b64\u6211\u4eec\u53ef\u4ee5\u8ba4\u4e3a\u6709\u4e24\u79cd\u51c6\u5165\u63a7\u5236\u5668\uff1a<code>\u53d8\u66f4\uff08mutating\uff09\u51c6\u5165\u63a7\u5236\u5668<\/code>\u548c<code>\u9a8c\u8bc1\uff08validating\uff09\u51c6\u5165\u63a7\u5236\u5668<\/code>\u3002<\/p>\n<p>\u51c6\u5165\u63a7\u5236\u8fc7\u7a0b\u4e5f\u540c\u6837\u5206\u4e3a\u4e24\u4e2a\u9636\u6bb5\u3002\u7b2c\u4e00\u9636\u6bb5\uff0c\u8fd0\u884c\u53d8\u66f4\u51c6\u5165\u63a7\u5236\u5668\uff0c\u5bf9\u5bf9\u8c61\u8fdb\u884c\u4fee\u6539\u64cd\u4f5c\uff1b\u7b2c\u4e8c\u9636\u6bb5\uff0c\u8fd0\u884c\u9a8c\u8bc1\u51c6\u5165\u63a7\u5236\u5668\u3002\u5982\u679c\u4efb\u4f55\u4e00\u4e2a\u9636\u6bb5\u7684\u4efb\u4f55\u63a7\u5236\u5668\u62d2\u7edd\u4e86\u8be5\u8bf7\u6c42\uff0c\u5219\u6574\u4e2a\u8bf7\u6c42\u5c06\u7acb\u5373\u88ab\u62d2\u7edd\uff0c\u5e76\u5411\u7ec8\u7aef\u7528\u6237\u8fd4\u56de\u4e00\u4e2a\u9519\u8bef\u3002<\/p>\n<p>\u6211\u4eec\u53ef\u4ee5\u901a\u8fc7\u4e0b\u9762\u7684\u56fe\u6765\u76f4\u89c2\u7684\u611f\u53d7\u4e00\u4e0b\uff1a<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.myway5.com\/wp-content\/uploads\/2020\/03\/webhooks.png\" alt=\"Kubernetes \u5f00\u53d1\u77e5\u8bc6--Kubernetes \u51c6\u5165\u63a7\u5236\u4e0e admission webhook \u7684\u4f7f\u7528\" \/><\/p>\n<h2>\u4e8c\u3001\u51c6\u5165\u63a7\u5236\u80fd\u505a\u4ec0\u4e48<\/h2>\n<p>\u51c6\u5165\u63a7\u5236\u5b58\u5728\u7684\u76ee\u7684\u5c31\u662f\u63d0\u9ad8 Kubernetes \u67b6\u6784\u7684\u7075\u6d3b\u6027\u3002\u56e0\u6b64 Kubernetes \u63d0\u4f9b\u4e86\u4e00\u4e9b\u51c6\u5165\u63a7\u5236\u5668\uff0c\u5e76\u4e14\u5141\u8bb8\u4f60\u6253\u5f00\u6216\u5173\u95ed\u4e00\u90e8\u5206\uff0c\u540c\u65f6\u4f60\u4e5f\u53ef\u4ee5\u81ea\u5b9a\u4e49\u51c6\u5165\u63a7\u5236\u5668\uff0c\u6765\u5b8c\u6210\u4f60\u81ea\u5df1\u7684\u4e00\u4e9b\u7279\u6b8a\u9700\u6c42\u3002\u53ef\u4ee5\u81ea\u5b9a\u4e49\u7684\u51c6\u5165\u63a7\u5236\u5668\u4e5f\u5206\u4e3a\u4e24\u79cd\uff1a\u4e00\u4e2a\u53eb <code>MutatingAdmissionWebhook<\/code>\uff0c\u4e00\u4e2a\u53eb <code>ValidatingAdmissionWebhook<\/code>\uff0c\u5176\u5b9e\u4e5f\u662f\u6211\u4eec\u4e0a\u9762\u8bf4\u7684<code>\u53d8\u66f4\u51c6\u5165\u63a7\u5236\u5668<\/code>\u548c<code>\u9a8c\u8bc1\u51c6\u5165\u63a7\u5236\u5668<\/code>\u3002<\/p>\n<p>Kubernetes \u63d0\u4f9b\u4e86\u4e00\u4e9b\u5e38\u7528\u7684\u51c6\u5165\u63a7\u5236\u5668\uff0c\u4e0b\u9762\u4e3e\u51e0\u4e2a\u4f8b\u5b50\uff1a<\/p>\n<ul>\n<li>AlwaysPullImages\uff1a \u8be5\u51c6\u5165\u63a7\u5236\u5668\u4f1a\u4fee\u6539\u6bcf\u4e00\u4e2a\u65b0\u521b\u5efa\u7684 Pod \u7684\u955c\u50cf\u62c9\u53d6\u7b56\u7565\u4e3a Always\u3002\u8fd9\u6837\u5728\u591a\u79df\u6237\u96c6\u7fa4\u91cc\uff0c\u7528\u6237\u5c31\u80fd\u4fdd\u8bc1\u81ea\u5df1\u7684\u79c1\u6709\u955c\u50cf\u53ea\u4f1a\u5728\u6709\u51ed\u8bc1\u7684\u60c5\u51b5\u4e0b\u4f7f\u7528\uff0c\u800c\u4e0d\u4f1a\u51fa\u73b0\u56e0\u4e3a\u673a\u5668\u4e0a\u7f13\u5b58\u4e86\u955c\u50cf\u800c\u88ab\u5176\u4ed6\u7528\u6237\u76f4\u63a5\u4f7f\u7528\u7684\u60c5\u51b5\u3002<\/p>\n<\/li>\n<li>\n<p>NamespaceLifecycle\uff1a\u8be5\u51c6\u5165\u63a7\u5236\u5668\u7981\u6b62\u5728\u4e00\u4e2a\u6b63\u5728\u88ab\u7ec8\u6b62\u7684 <code>Namespace<\/code> \u4e2d\u521b\u5efa\u65b0\u5bf9\u8c61\uff0c\u5e76\u4e14\u786e\u4fdd\u4f7f\u7528\u4e0d\u5b58\u5728\u7684 <code>Namespace<\/code> \u7684\u8bf7\u6c42\u88ab\u62d2\u7edd\u3002\u8be5\u51c6\u5165\u63a7\u5236\u5668\u8fd8\u4f1a\u7981\u6b62\u5220\u9664\u4e09\u4e2a\u7cfb\u7edf\u4fdd\u7559\u7684\u547d\u540d\u7a7a\u95f4\uff0c\u5373 <code>default<\/code>\u3001<code>kube-system<\/code> \u548c <code>kube-public<\/code>\u3002<\/p>\n<\/li>\n<\/ul>\n<p>\u9664\u4e86 Kubernetes \u63d0\u4f9b\u7684\u8fd9\u4e9b\u51c6\u5165\u63a7\u5236\u5668\uff0c\u6211\u4eec\u53ef\u4ee5\u7f16\u5199 <code>MutatingAdmissionWebhook<\/code> \u548c <code>ValidatingAdmissionWebhook<\/code>\u3002\u6bd4\u5982\u6211\u4e4b\u524d\u6709\u5199\u4e00\u4e2a\u53eb\u505a <code>[lazykube](https:\/\/github.com\/joyme123\/lazykube)<\/code> \u7684 <code>MutatingAdmissionWebhook<\/code>\uff0c\u5b83\u7684\u4f5c\u7528\u662f\u5bf9\u6bcf\u4e00\u4e2a\u521b\u5efa\u7684 Pod \u7684\u955c\u50cf\u6e90\u90fd\u8fdb\u884c\u6821\u9a8c\uff0c\u5982\u679c\u662f <code>docker hub<\/code>, <code>gcr.io<\/code>, <code>quay.io<\/code> \u7b49\u5730\u5740\u7684\u955c\u50cf\uff0c\u5c31\u4fee\u6539\u6210\u56fd\u5185\u7684\u4ee3\u7406\u6e90\uff0c\u8fd9\u6837\u5c31\u53ef\u4ee5\u81ea\u52a8\u89e3\u51b3\u955c\u50cf\u9700\u8981\u7ffb\u5899\u4e0b\u8f7d\u7684\u95ee\u9898\u4e86\u3002<\/p>\n<h2>\u4e09\u3001\u5982\u4f55\u4f7f\u7528 admission webhook \u7f16\u5199\u4e00\u4e2a\u51c6\u5165\u63a7\u5236\u5668<\/h2>\n<p>\u4f7f\u7528 admission webhook \u7f16\u5199\u4e00\u4e2a\u51c6\u5165\u63a7\u5236\u5668\u5176\u5b9e\u5f88\u7b80\u5355\uff0c\u5b83\u5c31\u548c\u4f60\u65e5\u5e38\u5199 web server \u4e00\u6837:<\/p>\n<pre><code class=\"language-go line-numbers\">\/\/ Start \u542f\u52a8\u670d\u52a1\nfunc (whsrv *WebhookServer) Start() error {\n    mux := http.NewServeMux()\n    mux.HandleFunc(\"\/mutate\", whsrv.serve)\n    whsrv.server.Handler = mux\n\n    if err := whsrv.server.ListenAndServeTLS(\"\", \"\"); err != nil {\n        return fmt.Errorf(\"Failed to listen and serve webhook server: %v\", err)\n    }\n\n    return nil\n}\n<\/code><\/pre>\n<p>\u5728\u6536\u5230\u4e00\u4e2a <code>AdmissionReview<\/code> \u8bf7\u6c42\u7684\u65f6\u5019\uff0c\u5c06\u5176\u4e2d\u7684 <code>AdmissionRequest<\/code> \u5bf9\u8c61\u643a\u5e26\u7684\u8d44\u6e90\u5bf9\u8c61\u53d6\u51fa\u6765\u8fdb\u884c\u6821\u9a8c\u6216\u53d8\u66f4\uff1a<\/p>\n<pre><code class=\"language-go line-numbers\">var body []byte\nif r.Body != nil {\n    if data, err := ioutil.ReadAll(r.Body); err == nil {\n        body = data\n    }\n}\n\nif len(body) == 0 {\n    log.Error(\"empty body\")\n    http.Error(w, \"empty body\", http.StatusBadRequest)\n    return\n}\n\n\/\/ verify the content type is accurate\ncontentType := r.Header.Get(\"Content-Type\")\nif contentType != \"application\/json\" {\n    log.Errorf(\"Content-Type=%s, expect application\/json\", contentType)\n    http.Error(w, \"invalid Content-Type, expect `application\/json`\", http.StatusUnsupportedMediaType)\n    return\n}\n\nvar admissionResponse *v1beta1.AdmissionResponse\nar := v1beta1.AdmissionReview{}\nif _, _, err := deserializer.Decode(body, nil, &amp;ar); err != nil {\n    log.Errorf(\"Can't decode body: %v\", err)\n    admissionResponse = &amp;v1beta1.AdmissionResponse{\n        Result: &amp;metav1.Status{\n            Message: err.Error(),\n        },\n    }\n} else {\n    admissionResponse = whsrv.mutate(&amp;ar)\n}\n<\/code><\/pre>\n<p>\u7136\u540e\u751f\u6210 <code>AdmissionResponse<\/code>, \u901a\u8fc7 <code>AdmissionReview<\/code> \u8fdb\u884c\u54cd\u5e94\u5373\u53ef\uff1a<\/p>\n<pre><code class=\"language-go line-numbers\">admissionReview := v1beta1.AdmissionReview{}\nif admissionResponse != nil {\n    admissionReview.Response = admissionResponse\n    if ar.Request != nil {\n        admissionReview.Response.UID = ar.Request.UID\n    }\n}\n\nresp, err := json.Marshal(admissionReview)\nif err != nil {\n    log.Errorf(\"Can't encode response: %v\", err)\n    http.Error(w, fmt.Sprintf(\"could not encode response: %v\", err), http.StatusInternalServerError)\n}\nlog.Infoln(\"Ready to write response ...\")\nif _, err := w.Write(resp); err != nil {\n    log.Errorf(\"Can't write response: %v\", err)\n    http.Error(w, fmt.Sprintf(\"could not write response: %v\", err), http.StatusInternalServerError)\n}\n<\/code><\/pre>\n<p>\u5b8c\u6574\u7684\u4ee3\u7801\u53ef\u4ee5\u53c2\u8003\u4e0a\u9762\u7684 lazykube \u9879\u76ee\u3002<\/p>\n<p>\u8fd9\u6837\u6211\u4eec\u5199\u597d\u4e4b\u540e\u5c31\u53ef\u4ee5\u5f00\u59cb\u90e8\u7f72\u4e86\u3002\u6211\u4eec\u9700\u8981\u544a\u8bc9 Kubernetes \u6211\u4eec\u7684 admission webhook \u7684\u5730\u5740\uff0c\u4ee5\u53ca\u6211\u4eec\u8981\u64cd\u4f5c\u7684\u8d44\u6e90\u5bf9\u8c61\uff0c\u56e0\u6b64\u6211\u4eec\u521b\u5efa\u4e00\u4e2a <code>MutatingWebhookConfiguration<\/code> \u6216\u8005 <code>ValidatingWebhookConfiguration<\/code> \u5bf9\u8c61\uff0c\u6bd4\u5982 lazykube \u5c31\u662f\u5bf9\u521b\u5efa Pod \u8fdb\u884c\u53d8\u66f4\u64cd\u4f5c\uff1a<\/p>\n<pre><code class=\"language-yaml line-numbers\">apiVersion: admissionregistration.k8s.io\/v1beta1\nkind: MutatingWebhookConfiguration\nmetadata:\n  name: lazykube-webhook-cfg\n  namespace: kube-system\n  labels:\n    app: lazykube\nwebhooks:\n  - name: lazykube.myway5.com\n    clientConfig:\n      service:\n        name: lazykube-webhook-svc\n        namespace: kube-system\n        path: \"\/mutate\"\n      caBundle: \u00d7\u00d7\u00d7\u00d7\u00d7\u00d7\u00d7\u00d7\n    rules:\n      - operations: [ \"CREATE\" ]\n        apiGroups: [\"\"]\n        apiVersions: [\"v1\"]\n        resources: [\"pods\"]\n<\/code><\/pre>\n<p>\u7136\u540e\u4e3a\u4e86\u8ba9 Kubernetes \u901a\u8fc7 HTTPS \u8fdb\u884c\u901a\u4fe1\uff0c\u5e76\u4fe1\u4efb\u6211\u4eec\u7684\u8bc1\u4e66\uff0c\u6211\u4eec\u9700\u8981\u8ba9 Kubernetes \u96c6\u7fa4\u4e3a\u6211\u4eec\u7684\u7b7e\u53d1\u8bc1\u4e66\u3002\u5177\u4f53\u7684\u65b9\u6cd5\u53ef\u4ee5\u53c2\u8003\u8fd9\u91cc\uff1a<a class=\"wp-editor-md-post-content-link\" href=\"https:\/\/www.myway5.com\/index.php\/2020\/03\/18\/kubernetes-%e9%9b%86%e7%be%a4%e4%b8%ad%e7%9a%84%e8%af%81%e4%b9%a6%e7%ad%be%e5%8f%91\/\">kubernetes \u96c6\u7fa4\u4e2d\u7684\u8bc1\u4e66\u7b7e\u53d1<\/a>\u3002\u6700\u540e\u4f7f\u7528 Deployment \u90e8\u7f72\u6211\u4eec\u7684\u670d\u52a1\u5373\u53ef\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4e00\u3001\u4ec0\u4e48\u662f\u51c6\u5165\u63a7\u5236 \u6211\u4eec\u90fd\u77e5\u9053 Kubernetes \u7684\u6700\u6838\u5fc3\u7ec4\u4ef6\u5c31\u662f\u5b83\u7684 API Server\uff0c\u6240\u6709\u8d44\u6e90\u7684\u521b &hellip; <a href=\"https:\/\/www.myway5.com\/index.php\/2020\/03\/19\/kubernetes-admission\/\" class=\"more-link\">\u7ee7\u7eed\u9605\u8bfb<span class=\"screen-reader-text\">Kubernetes \u5f00\u53d1\u77e5\u8bc6&#8211;Kubernetes \u51c6\u5165\u63a7\u5236\u4e0e admission webhook \u7684\u4f7f\u7528<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[89],"tags":[],"class_list":["post-570","post","type-post","status-publish","format-standard","hentry","category-k8s"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.4 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Kubernetes \u5f00\u53d1\u77e5\u8bc6-Kubernetes \u51c6\u5165\u63a7\u5236\u4e0e admission webhook \u7684\u4f7f\u7528 - \u4e00\u53ea\u5b89\u9759\u7684\u732b<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.myway5.com\/index.php\/2020\/03\/19\/kubernetes-admission\/\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Kubernetes \u5f00\u53d1\u77e5\u8bc6-Kubernetes \u51c6\u5165\u63a7\u5236\u4e0e admission webhook \u7684\u4f7f\u7528 - \u4e00\u53ea\u5b89\u9759\u7684\u732b\" \/>\n<meta property=\"og:description\" content=\"\u4e00\u3001\u4ec0\u4e48\u662f\u51c6\u5165\u63a7\u5236 \u6211\u4eec\u90fd\u77e5\u9053 Kubernetes \u7684\u6700\u6838\u5fc3\u7ec4\u4ef6\u5c31\u662f\u5b83\u7684 API Server\uff0c\u6240\u6709\u8d44\u6e90\u7684\u521b &hellip; \u7ee7\u7eed\u9605\u8bfbKubernetes \u5f00\u53d1\u77e5\u8bc6&#8211;Kubernetes \u51c6\u5165\u63a7\u5236\u4e0e admission webhook \u7684\u4f7f\u7528\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.myway5.com\/index.php\/2020\/03\/19\/kubernetes-admission\/\" \/>\n<meta property=\"og:site_name\" content=\"\u4e00\u53ea\u5b89\u9759\u7684\u732b\" \/>\n<meta property=\"article:published_time\" content=\"2020-03-19T15:43:17+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-07-05T13:31:01+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.myway5.com\/wp-content\/uploads\/2020\/03\/webhooks.png\" \/>\n<meta name=\"author\" content=\"jiangpengfei\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"jiangpengfei\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.myway5.com\/index.php\/2020\/03\/19\/kubernetes-admission\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.myway5.com\/index.php\/2020\/03\/19\/kubernetes-admission\/\"},\"author\":{\"name\":\"jiangpengfei\",\"@id\":\"https:\/\/www.myway5.com\/#\/schema\/person\/b19267e8b106343431e163ec96950685\"},\"headline\":\"Kubernetes \u5f00\u53d1\u77e5\u8bc6&#8211;Kubernetes \u51c6\u5165\u63a7\u5236\u4e0e admission webhook \u7684\u4f7f\u7528\",\"datePublished\":\"2020-03-19T15:43:17+00:00\",\"dateModified\":\"2023-07-05T13:31:01+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.myway5.com\/index.php\/2020\/03\/19\/kubernetes-admission\/\"},\"wordCount\":40,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.myway5.com\/#\/schema\/person\/b19267e8b106343431e163ec96950685\"},\"image\":{\"@id\":\"https:\/\/www.myway5.com\/index.php\/2020\/03\/19\/kubernetes-admission\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.myway5.com\/wp-content\/uploads\/2020\/03\/webhooks.png\",\"articleSection\":[\"k8s\"],\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.myway5.com\/index.php\/2020\/03\/19\/kubernetes-admission\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.myway5.com\/index.php\/2020\/03\/19\/kubernetes-admission\/\",\"url\":\"https:\/\/www.myway5.com\/index.php\/2020\/03\/19\/kubernetes-admission\/\",\"name\":\"Kubernetes \u5f00\u53d1\u77e5\u8bc6-Kubernetes \u51c6\u5165\u63a7\u5236\u4e0e admission webhook \u7684\u4f7f\u7528 - \u4e00\u53ea\u5b89\u9759\u7684\u732b\",\"isPartOf\":{\"@id\":\"https:\/\/www.myway5.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.myway5.com\/index.php\/2020\/03\/19\/kubernetes-admission\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.myway5.com\/index.php\/2020\/03\/19\/kubernetes-admission\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.myway5.com\/wp-content\/uploads\/2020\/03\/webhooks.png\",\"datePublished\":\"2020-03-19T15:43:17+00:00\",\"dateModified\":\"2023-07-05T13:31:01+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/www.myway5.com\/index.php\/2020\/03\/19\/kubernetes-admission\/#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.myway5.com\/index.php\/2020\/03\/19\/kubernetes-admission\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.myway5.com\/index.php\/2020\/03\/19\/kubernetes-admission\/#primaryimage\",\"url\":\"https:\/\/www.myway5.com\/wp-content\/uploads\/2020\/03\/webhooks.png\",\"contentUrl\":\"https:\/\/www.myway5.com\/wp-content\/uploads\/2020\/03\/webhooks.png\",\"width\":3836,\"height\":1632},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.myway5.com\/index.php\/2020\/03\/19\/kubernetes-admission\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.myway5.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Kubernetes \u5f00\u53d1\u77e5\u8bc6&#8211;Kubernetes \u51c6\u5165\u63a7\u5236\u4e0e admission webhook \u7684\u4f7f\u7528\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.myway5.com\/#website\",\"url\":\"https:\/\/www.myway5.com\/\",\"name\":\"\u4e00\u53ea\u5b89\u9759\u7684\u732b\",\"description\":\"\u60f3\u5565\u5462\",\"publisher\":{\"@id\":\"https:\/\/www.myway5.com\/#\/schema\/person\/b19267e8b106343431e163ec96950685\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.myway5.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"zh-Hans\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/www.myway5.com\/#\/schema\/person\/b19267e8b106343431e163ec96950685\",\"name\":\"jiangpengfei\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.myway5.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/f8c7de757f6e0247412bcfd31b7c2271?s=96&d=monsterid&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/f8c7de757f6e0247412bcfd31b7c2271?s=96&d=monsterid&r=g\",\"caption\":\"jiangpengfei\"},\"logo\":{\"@id\":\"https:\/\/www.myway5.com\/#\/schema\/person\/image\/\"},\"url\":\"https:\/\/www.myway5.com\/index.php\/author\/joyme\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Kubernetes \u5f00\u53d1\u77e5\u8bc6-Kubernetes \u51c6\u5165\u63a7\u5236\u4e0e admission webhook \u7684\u4f7f\u7528 - \u4e00\u53ea\u5b89\u9759\u7684\u732b","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.myway5.com\/index.php\/2020\/03\/19\/kubernetes-admission\/","og_locale":"zh_CN","og_type":"article","og_title":"Kubernetes \u5f00\u53d1\u77e5\u8bc6-Kubernetes \u51c6\u5165\u63a7\u5236\u4e0e admission webhook \u7684\u4f7f\u7528 - \u4e00\u53ea\u5b89\u9759\u7684\u732b","og_description":"\u4e00\u3001\u4ec0\u4e48\u662f\u51c6\u5165\u63a7\u5236 \u6211\u4eec\u90fd\u77e5\u9053 Kubernetes \u7684\u6700\u6838\u5fc3\u7ec4\u4ef6\u5c31\u662f\u5b83\u7684 API Server\uff0c\u6240\u6709\u8d44\u6e90\u7684\u521b &hellip; \u7ee7\u7eed\u9605\u8bfbKubernetes \u5f00\u53d1\u77e5\u8bc6&#8211;Kubernetes \u51c6\u5165\u63a7\u5236\u4e0e admission webhook \u7684\u4f7f\u7528","og_url":"https:\/\/www.myway5.com\/index.php\/2020\/03\/19\/kubernetes-admission\/","og_site_name":"\u4e00\u53ea\u5b89\u9759\u7684\u732b","article_published_time":"2020-03-19T15:43:17+00:00","article_modified_time":"2023-07-05T13:31:01+00:00","og_image":[{"url":"https:\/\/www.myway5.com\/wp-content\/uploads\/2020\/03\/webhooks.png","type":"","width":"","height":""}],"author":"jiangpengfei","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"jiangpengfei","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"2 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.myway5.com\/index.php\/2020\/03\/19\/kubernetes-admission\/#article","isPartOf":{"@id":"https:\/\/www.myway5.com\/index.php\/2020\/03\/19\/kubernetes-admission\/"},"author":{"name":"jiangpengfei","@id":"https:\/\/www.myway5.com\/#\/schema\/person\/b19267e8b106343431e163ec96950685"},"headline":"Kubernetes \u5f00\u53d1\u77e5\u8bc6&#8211;Kubernetes \u51c6\u5165\u63a7\u5236\u4e0e admission webhook \u7684\u4f7f\u7528","datePublished":"2020-03-19T15:43:17+00:00","dateModified":"2023-07-05T13:31:01+00:00","mainEntityOfPage":{"@id":"https:\/\/www.myway5.com\/index.php\/2020\/03\/19\/kubernetes-admission\/"},"wordCount":40,"commentCount":0,"publisher":{"@id":"https:\/\/www.myway5.com\/#\/schema\/person\/b19267e8b106343431e163ec96950685"},"image":{"@id":"https:\/\/www.myway5.com\/index.php\/2020\/03\/19\/kubernetes-admission\/#primaryimage"},"thumbnailUrl":"https:\/\/www.myway5.com\/wp-content\/uploads\/2020\/03\/webhooks.png","articleSection":["k8s"],"inLanguage":"zh-Hans","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.myway5.com\/index.php\/2020\/03\/19\/kubernetes-admission\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.myway5.com\/index.php\/2020\/03\/19\/kubernetes-admission\/","url":"https:\/\/www.myway5.com\/index.php\/2020\/03\/19\/kubernetes-admission\/","name":"Kubernetes \u5f00\u53d1\u77e5\u8bc6-Kubernetes \u51c6\u5165\u63a7\u5236\u4e0e admission webhook \u7684\u4f7f\u7528 - \u4e00\u53ea\u5b89\u9759\u7684\u732b","isPartOf":{"@id":"https:\/\/www.myway5.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.myway5.com\/index.php\/2020\/03\/19\/kubernetes-admission\/#primaryimage"},"image":{"@id":"https:\/\/www.myway5.com\/index.php\/2020\/03\/19\/kubernetes-admission\/#primaryimage"},"thumbnailUrl":"https:\/\/www.myway5.com\/wp-content\/uploads\/2020\/03\/webhooks.png","datePublished":"2020-03-19T15:43:17+00:00","dateModified":"2023-07-05T13:31:01+00:00","breadcrumb":{"@id":"https:\/\/www.myway5.com\/index.php\/2020\/03\/19\/kubernetes-admission\/#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.myway5.com\/index.php\/2020\/03\/19\/kubernetes-admission\/"]}]},{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.myway5.com\/index.php\/2020\/03\/19\/kubernetes-admission\/#primaryimage","url":"https:\/\/www.myway5.com\/wp-content\/uploads\/2020\/03\/webhooks.png","contentUrl":"https:\/\/www.myway5.com\/wp-content\/uploads\/2020\/03\/webhooks.png","width":3836,"height":1632},{"@type":"BreadcrumbList","@id":"https:\/\/www.myway5.com\/index.php\/2020\/03\/19\/kubernetes-admission\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.myway5.com\/"},{"@type":"ListItem","position":2,"name":"Kubernetes \u5f00\u53d1\u77e5\u8bc6&#8211;Kubernetes \u51c6\u5165\u63a7\u5236\u4e0e admission webhook \u7684\u4f7f\u7528"}]},{"@type":"WebSite","@id":"https:\/\/www.myway5.com\/#website","url":"https:\/\/www.myway5.com\/","name":"\u4e00\u53ea\u5b89\u9759\u7684\u732b","description":"\u60f3\u5565\u5462","publisher":{"@id":"https:\/\/www.myway5.com\/#\/schema\/person\/b19267e8b106343431e163ec96950685"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.myway5.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"zh-Hans"},{"@type":["Person","Organization"],"@id":"https:\/\/www.myway5.com\/#\/schema\/person\/b19267e8b106343431e163ec96950685","name":"jiangpengfei","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.myway5.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/f8c7de757f6e0247412bcfd31b7c2271?s=96&d=monsterid&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/f8c7de757f6e0247412bcfd31b7c2271?s=96&d=monsterid&r=g","caption":"jiangpengfei"},"logo":{"@id":"https:\/\/www.myway5.com\/#\/schema\/person\/image\/"},"url":"https:\/\/www.myway5.com\/index.php\/author\/joyme\/"}]}},"views":5672,"_links":{"self":[{"href":"https:\/\/www.myway5.com\/index.php\/wp-json\/wp\/v2\/posts\/570","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.myway5.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.myway5.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.myway5.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.myway5.com\/index.php\/wp-json\/wp\/v2\/comments?post=570"}],"version-history":[{"count":1,"href":"https:\/\/www.myway5.com\/index.php\/wp-json\/wp\/v2\/posts\/570\/revisions"}],"predecessor-version":[{"id":1553,"href":"https:\/\/www.myway5.com\/index.php\/wp-json\/wp\/v2\/posts\/570\/revisions\/1553"}],"wp:attachment":[{"href":"https:\/\/www.myway5.com\/index.php\/wp-json\/wp\/v2\/media?parent=570"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.myway5.com\/index.php\/wp-json\/wp\/v2\/categories?post=570"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.myway5.com\/index.php\/wp-json\/wp\/v2\/tags?post=570"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}