{"id":118636,"date":"2026-10-27T22:16:33","date_gmt":"2026-10-27T14:16:33","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/118636.html"},"modified":"2026-10-27T22:16:33","modified_gmt":"2026-10-27T14:16:33","slug":"1027-kubernetes%e8%b0%83%e5%ba%a6%e5%99%a8metricserver%e4%b8%8ehpa%e5%b0%8f%e7%99%bd%e6%95%99%e7%a8%8b","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/118636.html","title":{"rendered":"1027 Kubernetes\u8c03\u5ea6\u5668MetricServer\u4e0eHPA\u5c0f\u767d\u6559\u7a0b"},"content":{"rendered":"<h2>Kubernetes \u8c03\u5ea6\u5668\u3001Metric Server \u4e0e HPA \u5c0f\u767d\u6559\u7a0b<\/h2>\n<p>\u8fd9\u8282\u8bb2\u4e24\u4ef6\u4e8b&#xff1a;\u2460 Pod \u521b\u5efa\u51fa\u6765\u540e&#xff0c;kube-scheduler \u51ed\u4ec0\u4e48\u51b3\u5b9a\u628a\u5b83\u6254\u5230\u54ea\u4e2a\u8282\u70b9&#xff1b;\u2461 \u600e\u4e48\u6839\u636e Pod \u7684 CPU\/\u5185\u5b58\u4f7f\u7528\u7387\u81ea\u52a8\u6269\u7f29\u526f\u672c\u6570&#xff08;HPA&#xff09;\u3002<\/p>\n<hr \/>\n<h3>\u4e00\u3001Pod \u8c03\u5ea6\u5168\u6d41\u7a0b<\/h3>\n<h4>1.1 \u76f4\u63a5\u521b\u5efa Pod \u7684\u4e03\u6b65\u8d70<\/h4>\n<li>\u5ba2\u6237\u7aef\u53d1\u8bf7\u6c42\u7ed9 kube-apiserver\u3002<\/li>\n<li>apiserver \u505a\u8ba4\u8bc1\u3001\u6388\u6743\u3001\u51c6\u5165\u6821\u9a8c&#xff0c;\u901a\u8fc7\u540e\u628a Pod \u5199\u8fdb etcd&#xff0c;\u6b64\u65f6 Pod \u72b6\u6001\u662f Pending&#xff0c;spec.nodeName \u4e3a\u7a7a\u3002<\/li>\n<li>kube-scheduler \u901a\u8fc7 List-Watch \u76d1\u542c\u5230\u8fd9\u4e2a Pending Pod&#xff0c;\u5f00\u59cb\u5e72\u6d3b&#xff1a;\n<ul>\n<li>\u8fc7\u6ee4&#xff08;Filter&#xff09;&#xff1a;\u5148\u5254\u9664\u660e\u663e\u4e0d\u884c\u7684\u8282\u70b9&#xff08;\u8d44\u6e90\u4e0d\u591f\u3001\u6c61\u70b9\u4e0d\u5339\u914d\u3001\u8282\u70b9\u88ab cordon\u3001\u4eb2\u548c\u89c4\u5219\u4e0d\u6ee1\u8db3&#xff09;\u3002<\/li>\n<li>\u6253\u5206&#xff08;Score&#xff09;&#xff1a;\u5728\u5269\u4e0b\u7684\u5019\u9009\u8282\u70b9\u91cc\u6253\u5206&#xff0c;\u9009\u5f97\u5206\u6700\u9ad8\u7684\u3002<\/li>\n<li>\u5411 apiserver \u53d1\u8d77\u7ed1\u5b9a\u8bf7\u6c42&#xff0c;\u628a Pod \u548c\u76ee\u6807\u8282\u70b9\u7ed1\u8d77\u6765\u3002<\/li>\n<\/ul>\n<\/li>\n<li>apiserver \u66f4\u65b0 Pod \u7684 spec.nodeName&#xff0c;\u5199\u56de etcd\u3002<\/li>\n<li>\u76ee\u6807\u8282\u70b9\u4e0a\u7684 kubelet \u76d1\u542c\u5230&#034;\u6709 Pod \u7ed1\u7ed9\u6211\u4e86&#034;&#xff0c;\u5f00\u59cb\u51c6\u5907\u5b58\u50a8&#xff08;CSI&#xff09;\u3001\u7f51\u7edc&#xff08;CNI&#xff09;\u3002<\/li>\n<li>kubelet \u8c03\u7528\u5bb9\u5668\u8fd0\u884c\u65f6\u62c9\u955c\u50cf\u3001\u542f\u52a8\u5bb9\u5668\u3002<\/li>\n<li>kubelet \u786e\u8ba4\u5bb9\u5668\u8dd1\u8d77\u6765\u4e86&#xff0c;\u4e0a\u62a5\u72b6\u6001&#xff0c;Pod \u53d8\u6210 Running\u3002<\/li>\n<p>\u4e00\u53e5\u8bdd&#xff1a;scheduler \u53ea\u7ba1\u9009\u8282\u70b9&#xff0c;kubelet \u624d\u7ba1\u542f\u52a8\u5bb9\u5668&#xff0c;controller-manager \u53ea\u7ba1\u6309\u526f\u672c\u6570\u521b\u5efa\/\u5220\u9664 Pod\u3002<\/p>\n<h4>1.2 \u901a\u8fc7 Deployment \u521b\u5efa Pod \u591a\u4e86\u8c01<\/h4>\n<p>\u8ddf\u76f4\u63a5\u521b\u5efa Pod \u76f8\u6bd4&#xff0c;\u591a\u4e86\u4e00\u4e2a kube-controller-manager&#xff1a;<\/p>\n<p>Client \u2192 apiserver \u2192 etcd \u2192 controller-manager \u2192 scheduler \u2192 kubelet \u2192 \u5bb9\u5668\u8fd0\u884c\u65f6<\/p>\n<p>controller-manager \u91cc\u8dd1\u7740 Deployment \u63a7\u5236\u5668&#xff0c;\u5b83\u5bf9\u6bd4&#034;\u671f\u671b\u526f\u672c\u6570&#034;\u548c&#034;\u73b0\u6709 Pod \u6570&#034;&#xff0c;\u5dee\u51e0\u4e2a\u5c31\u8c03 apiserver \u521b\u5efa\u51e0\u4e2a\u65b0 Pod\u3002\u65b0 Pod \u51fa\u6765\u4e4b\u540e&#xff0c;\u540e\u9762\u7684\u6d41\u7a0b\u8ddf\u4e0a\u9762\u4e00\u6a21\u4e00\u6837\u3002<\/p>\n<hr \/>\n<h3>\u4e8c\u3001\u4e94\u79cd\u63a7\u5236 Pod \u8c03\u5ea6\u4f4d\u7f6e\u7684\u624b\u6bb5<\/h3>\n<table>\n<tr>\u624b\u6bb5\u65b9\u5411\u5f3a\u5236\u7a0b\u5ea6<\/tr>\n<tbody>\n<tr>\n<td align=\"left\">nodeName<\/td>\n<td align=\"left\">Pod \u6307\u5b9a\u8282\u70b9<\/td>\n<td align=\"left\">\u6700\u786c&#xff0c;\u7ed5\u8fc7\u8c03\u5ea6\u5668<\/td>\n<\/tr>\n<tr>\n<td align=\"left\">nodeSelector<\/td>\n<td align=\"left\">Pod \u9009\u8282\u70b9\u6807\u7b7e<\/td>\n<td align=\"left\">\u7b80\u5355\u786c\u5339\u914d<\/td>\n<\/tr>\n<tr>\n<td align=\"left\">nodeAffinity<\/td>\n<td align=\"left\">Pod \u9009\u8282\u70b9\u6807\u7b7e<\/td>\n<td align=\"left\">\u652f\u6301 In\/NotIn\/Exists&#xff0c;\u652f\u6301\u4f18\u5148\u7b56\u7565<\/td>\n<\/tr>\n<tr>\n<td align=\"left\">podAffinity \/ podAntiAffinity<\/td>\n<td align=\"left\">Pod \u9009\u5176\u4ed6 Pod \u5728\u54ea<\/td>\n<td align=\"left\">\u6309\u5df2\u8fd0\u884c\u7684 Pod \u6807\u7b7e\u51b3\u5b9a\u4f4d\u7f6e<\/td>\n<\/tr>\n<tr>\n<td align=\"left\">taint \/ toleration<\/td>\n<td align=\"left\">\u8282\u70b9\u9009 Pod<\/td>\n<td align=\"left\">\u8282\u70b9\u4e3b\u52a8\u62d2\u7edd\u4e0d\u5339\u914d\u7684 Pod<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h4>2.1 nodeName&#xff08;\u6700\u66b4\u529b&#xff09;<\/h4>\n<p>\u76f4\u63a5\u5728 Pod spec \u91cc\u5199\u6b7b\u8282\u70b9\u540d&#xff0c;\u8c03\u5ea6\u5668\u8fde\u6253\u5206\u90fd\u4e0d\u505a&#xff0c;\u76f4\u63a5\u6254\u8fc7\u53bb\u3002\u7f3a\u70b9&#xff1a;\u8282\u70b9\u4e0d\u5b58\u5728\u5c31\u8c03\u5ea6\u5931\u8d25&#xff0c;\u8282\u70b9\u8d44\u6e90\u4e0d\u591f\u4e5f\u76f4\u63a5\u62a5\u9519\u3002\u751f\u4ea7\u57fa\u672c\u4e0d\u7528\u3002<\/p>\n<p>apiVersion: apps\/v1<br \/>\nkind: Deployment<br \/>\nmetadata:<br \/>\n  name: webapp<br \/>\nspec:<br \/>\n  replicas: 2<br \/>\n  selector:<br \/>\n    matchLabels:<br \/>\n      app: webapp<br \/>\n  template:<br \/>\n    metadata:<br \/>\n      labels:<br \/>\n        app: webapp<br \/>\n    spec:<br \/>\n      nodeName: worker32.lcm.cloud                          # \u76f4\u63a5\u5199\u6b7b\u8282\u70b9\u540d<br \/>\n      containers:<br \/>\n      &#8211; image: hub.lcm.cloud\/library\/nginx<br \/>\n        name: nginx<\/p>\n<p>kubectl apply -f deploy-with-nodeName.yaml<br \/>\nkubectl get pods -o wide | awk &#039;{print $1,$3,$7}&#039;           # \u770bPod\u662f\u4e0d\u662f\u90fd\u8dd1\u5728worker32<\/p>\n<h4>2.2 nodeSelector&#xff08;\u6700\u7b80\u5355\u7684\u6807\u7b7e\u5339\u914d&#xff09;<\/h4>\n<p>\u5148\u7ed9\u8282\u70b9\u6253\u6807\u7b7e&#xff1a;<\/p>\n<p>kubectl get node &#8211;show-labels                              # \u770b\u8282\u70b9\u73b0\u6709\u6807\u7b7e<br \/>\nkubectl label node worker31.lcm.cloud disktype&#061;ssd          # \u7ed9worker31\u6253disktype&#061;ssd\u6807\u7b7e<br \/>\nkubectl get node -L disktype                                # \u9a8c\u8bc1\u6807\u7b7e\u6253\u4e0a\u4e86<\/p>\n<p>\u5728 Pod spec \u91cc\u5199 nodeSelector&#xff1a;<\/p>\n<p>spec:<br \/>\n  nodeSelector:<br \/>\n    disktype: ssd                                           # \u53ea\u8c03\u5ea6\u5230\u5e26disktype&#061;ssd\u6807\u7b7e\u7684\u8282\u70b9<br \/>\n  containers:<br \/>\n  &#8211; image: hub.lcm.cloud\/library\/nginx<br \/>\n    name: nginx<\/p>\n<p>kubectl apply -f deploy-with-nodeSelector.yaml<br \/>\nkubectl get pods -o wide | awk &#039;{print $1,$3,$7}&#039;           # Pod\u5168\u8dd1\u5728worker31<\/p>\n<p>\u6ce8\u610f\u4e00\u4e2a\u5751&#xff1a;\u5220\u6389\u8282\u70b9\u6807\u7b7e\u4e0d\u4f1a\u89e6\u53d1 Pod \u91cd\u65b0\u8c03\u5ea6&#xff0c;Pod \u7ee7\u7eed\u5728\u539f\u8282\u70b9\u8dd1&#xff1b;\u53ea\u6709\u5220\u6389 Deployment \u91cc\u7684 nodeSelector \u624d\u4f1a\u89e6\u53d1\u91cd\u5efa\u3002<\/p>\n<p>kubectl label node worker31.lcm.cloud disktype-             # \u5220\u6807\u7b7e&#xff0c;Pod\u4e0d\u4f1a\u52a8<br \/>\nkubectl patch deployment webapp &#8211;type json -p &#039;[{&#034;op&#034;:&#034;remove&#034;,&#034;path&#034;:&#034;\/spec\/template\/spec\/nodeSelector&#034;}]&#039;  # \u5220nodeSelector&#xff0c;\u89e6\u53d1\u91cd\u5efa<\/p>\n<h4>2.3 nodeAffinity&#xff08;\u8282\u70b9\u4eb2\u548c\u6027&#xff0c;\u52a0\u5f3a\u7248 nodeSelector&#xff09;<\/h4>\n<p>\u4e24\u79cd\u6a21\u5f0f&#xff1a;<\/p>\n<ul>\n<li>\n<p>requiredDuringSchedulingIgnoredDuringExecution&#xff1a;\u5fc5\u987b\u6ee1\u8db3&#xff0c;\u8ddf nodeSelector \u4e00\u6837\u786c&#xff0c;\u53ea\u662f\u652f\u6301\u66f4\u590d\u6742\u7684\u8868\u8fbe\u5f0f\u3002<\/p>\n<\/li>\n<li>\n<p>preferredDuringSchedulingIgnoredDuringExecution&#xff1a;\u4f18\u5148\u6ee1\u8db3&#xff0c;\u6253\u5206\u65f6\u503e\u5411\u5339\u914d\u7684\u8282\u70b9&#xff0c;\u4f46\u4e0d\u4f1a\u5f3a\u5236\u3002<\/p>\n<p>spec:<br \/>\naffinity:<br \/>\nnodeAffinity:<br \/>\nrequiredDuringSchedulingIgnoredDuringExecution:<br \/>\nnodeSelectorTerms:<br \/>\n&#8211; matchExpressions:<br \/>\n&#8211; key: CPU<br \/>\noperator: In<br \/>\nvalues: [L1, L2]                               # \u5fc5\u987b\u6253\u4e86CPU&#061;L1\u6216L2\u6807\u7b7e<br \/>\npreferredDuringSchedulingIgnoredDuringExecution:<br \/>\n&#8211; weight: 1                                           # \u6743\u91cd1-100<br \/>\npreference:<br \/>\nmatchExpressions:<br \/>\n&#8211; key: MEM<br \/>\noperator: In<br \/>\nvalues: [L1, L2]                                 # \u4f18\u5148\u9009\u5e26MEM&#061;L1\/L2\u7684\u8282\u70b9<\/p>\n<\/li>\n<\/ul>\n<p>operator \u652f\u6301&#xff1a;In\u3001NotIn\u3001Exists\u3001DoesNotExist\u3001Gt\u3001Lt\u3002<\/p>\n<p>\u6253\u6807\u7b7e\u5b9e\u9a8c&#xff1a;<\/p>\n<p>kubectl label nodes worker31.lcm.cloud CPU&#061;L1                # worker31\u6253CPU&#061;L1<br \/>\nkubectl label nodes worker32.lcm.cloud CPU&#061;L2               # worker32\u6253CPU&#061;L2<br \/>\nkubectl rollout restart deployment web                       # \u91cd\u5efa&#xff0c;Pod\u4f1a\u5206\u6563\u5230\u4e24\u4e2a\u8282\u70b9<br \/>\nkubectl label nodes worker32.lcm.cloud MEM&#061;L2                # \u7ed9worker32\u52a0MEM&#061;L2\u504f\u597d<br \/>\nkubectl rollout restart deployment web                       # \u91cd\u542f\u540ePod\u4f18\u5148\u5806\u5728worker32<\/p>\n<h4>2.4 podAffinity \/ podAntiAffinity&#xff08;Pod \u95f4\u4eb2\u548c\/\u53cd\u4eb2\u548c&#xff09;<\/h4>\n<p>\u4e0d\u662f\u770b\u8282\u70b9\u6807\u7b7e&#xff0c;\u800c\u662f\u770b&#034;\u8fd9\u4e2a\u8282\u70b9\u4e0a\u5df2\u7ecf\u8dd1\u4e86\u4ec0\u4e48 Pod&#034;&#xff1a;<\/p>\n<ul>\n<li>\u4eb2\u548c&#xff1a;\u6211\u60f3\u8ddf\u67d0\u4e2a Pod \u5f85\u5728\u540c\u4e00\u4e2a\u62d3\u6251\u57df\u91cc\u3002<\/li>\n<li>\u53cd\u4eb2\u548c&#xff1a;\u6211\u4e0d\u60f3\u8ddf\u67d0\u4e2a Pod \u5f85\u5728\u540c\u4e00\u4e2a\u62d3\u6251\u57df\u91cc\u3002<\/li>\n<\/ul>\n<p>\u62d3\u6251\u57df\u7528 topologyKey \u8868\u793a&#xff0c;\u6700\u5e38\u7528\u7684\u662f kubernetes.io\/hostname&#xff08;\u6309\u8282\u70b9\u9694\u79bb&#xff09;\u3002<\/p>\n<p>\u793a\u4f8b&#xff1a;\u53cd\u4eb2\u548c\u8ba9\u540c\u670d\u52a1\u7684 Pod \u5206\u6563\u5230\u4e0d\u540c\u8282\u70b9<\/p>\n<p>spec:<br \/>\n  affinity:<br \/>\n    podAntiAffinity:<br \/>\n      requiredDuringSchedulingIgnoredDuringExecution:<br \/>\n      &#8211; labelSelector:<br \/>\n          matchExpressions:<br \/>\n          &#8211; key: app<br \/>\n            operator: In<br \/>\n            values: [store]<br \/>\n        topologyKey: &#034;kubernetes.io\/hostname&#034;                # \u540c\u4e00\u4e2ahostname\u8282\u70b9\u4e0a\u53ea\u80fd\u8dd1\u4e00\u4e2a<\/p>\n<p>\u6548\u679c&#xff1a;3 \u4e2a\u526f\u672c\u7684 Pod \u4f1a\u88ab\u6253\u6563\u5230 3 \u4e2a\u4e0d\u540c\u8282\u70b9&#xff0c;\u8282\u70b9\u4e0d\u591f\u5c31 Pending\u3002<\/p>\n<p>\u793a\u4f8b&#xff1a;\u4eb2\u548c\u8ba9 web \u8ddf store \u5f85\u5728\u4e00\u8d77<\/p>\n<p>spec:<br \/>\n  affinity:<br \/>\n    podAffinity:<br \/>\n      requiredDuringSchedulingIgnoredDuringExecution:<br \/>\n      &#8211; labelSelector:<br \/>\n          matchExpressions:<br \/>\n          &#8211; key: app<br \/>\n            operator: In<br \/>\n            values: [store]<br \/>\n        topologyKey: topology.kubernetes.io\/zone            # \u540c\u4e00\u4e2azone\u91cc\u6709store Pod\u7684\u8282\u70b9\u624d\u80fd\u8c03\u5ea6<\/p>\n<h4>2.5 taint&#xff08;\u6c61\u70b9&#xff09;\u548c toleration&#xff08;\u5bb9\u5fcd&#xff09;<\/h4>\n<p>\u524d\u9762\u90fd\u662f&#034;Pod \u9009\u8282\u70b9&#034;&#xff0c;taint \u53cd\u8fc7\u6765&#xff1a;\u8282\u70b9\u4e3b\u52a8\u62c9\u9ed1\u4e0d\u5339\u914d\u7684 Pod\u3002<\/p>\n<p>\u4e00\u53e5\u8bdd\u8bb0\u5fc6&#xff1a;nodeAffinity \u662f Pod \u6311\u8282\u70b9&#xff0c;taint \u662f\u8282\u70b9\u6311 Pod\u3002<\/p>\n<p>\u7ed9\u8282\u70b9\u6253\u6c61\u70b9&#xff1a;<\/p>\n<p>kubectl taint nodes worker31.lcm.cloud CPU&#061;L1:NoSchedule    # worker31\u52a0\u6c61\u70b9&#xff1a;CPU&#061;L1&#xff0c;\u6548\u679cNoSchedule<\/p>\n<p>\u4e09\u79cd effect&#xff1a;<\/p>\n<ul>\n<li>NoSchedule&#xff1a;\u65b0 Pod \u6ca1\u5339\u914d\u5bb9\u5fcd\u5ea6\u5c31\u522b\u60f3\u4e0a\u6765&#xff0c;\u5df2\u7ecf\u5728\u8dd1\u7684 Pod \u4e0d\u52a8\u3002<\/li>\n<li>PreferNoSchedule&#xff1a;\u8f6f\u62d2\u7edd&#xff0c;\u5c3d\u91cf\u4e0d\u8c03\u5ea6&#xff0c;\u4f46\u5b9e\u5728\u6ca1\u5730\u65b9\u4e5f\u4f1a\u585e\u4e0a\u53bb\u3002<\/li>\n<li>NoExecute&#xff1a;\u4e0d\u4ec5\u4e0d\u8ba9\u65b0 Pod \u4e0a\u6765&#xff0c;\u5df2\u7ecf\u5728\u8dd1\u7684\u4e0d\u5339\u914d Pod \u76f4\u63a5\u9a71\u9010\u3002<\/li>\n<\/ul>\n<p>Pod \u91cc\u5199\u5bb9\u5fcd\u5ea6&#xff1a;<\/p>\n<p>spec:<br \/>\n  tolerations:<br \/>\n  &#8211; key: &#034;CPU&#034;<br \/>\n    operator: &#034;Equal&#034;<br \/>\n    value: &#034;L1&#034;<br \/>\n    effect: &#034;NoSchedule&#034;<\/p>\n<p>operator \u4e24\u79cd&#xff1a;<\/p>\n<ul>\n<li>Equal&#xff1a;\u952e\u503c\u90fd\u8981\u5bf9\u5f97\u4e0a\u3002<\/li>\n<li>Exists&#xff1a;\u53ea\u8981 key \u5b58\u5728\u5c31\u884c&#xff0c;\u4e0d\u5199 value&#xff08;\u7b49\u4e8e\u5bb9\u5fcd\u6240\u6709\u8be5 key \u7684\u6c61\u70b9&#xff09;\u3002<\/li>\n<\/ul>\n<p>\u5220\u6c61\u70b9&#xff1a;<\/p>\n<p>kubectl taint nodes worker31.lcm.cloud CPU:NoSchedule-    # \u672b\u5c3e\u52a0\u6a2a\u6760\u5c31\u662f\u5220<\/p>\n<h4>2.6 cordon \/ uncordon \/ drain&#xff08;\u8282\u70b9\u7ef4\u62a4\u4e09\u8fde&#xff09;<\/h4>\n<p>kubectl cordon worker31.lcm.cloud                            # \u6807\u8bb0\u8282\u70b9\u4e3aSchedulingDisabled&#xff0c;\u4e0d\u8ba9\u65b0Pod\u4e0a\u6765<br \/>\nkubectl get nodes                                           # \u72b6\u6001\u53d8\u6210Ready,SchedulingDisabled<br \/>\nkubectl uncordon worker31.lcm.cloud                         # \u6062\u590d\u53ef\u8c03\u5ea6<\/p>\n<p>kubectl drain worker31.lcm.cloud &#8211;ignore-daemonsets        # \u9a71\u9010\u8282\u70b9\u4e0a\u6240\u6709Pod&#xff0c;\u540c\u65f6\u81ea\u52a8cordon<br \/>\n# &#8211;ignore-daemonsets&#xff1a;\u5ffd\u7565DaemonSet\u7ba1\u7406\u7684Pod&#xff08;calico\u3001kube-proxy\u8fd9\u4e9b\u4e0d\u80fd\u5220&#xff09;<br \/>\nkubectl uncordon worker31.lcm.cloud                         # \u7ef4\u62a4\u5b8c\u6062\u590d<\/p>\n<hr \/>\n<h3>\u4e09\u3001Metric Server&#xff08;\u76d1\u63a7\u6307\u6807\u91c7\u96c6&#xff09;<\/h3>\n<h4>3.1 \u5b83\u662f\u5e72\u561b\u7684<\/h4>\n<p>K8s \u672c\u8eab\u4e0d\u77e5\u9053\u6bcf\u4e2a Pod \u7528\u4e86\u591a\u5c11 CPU\u3001\u591a\u5c11\u5185\u5b58\u3002Metric Server \u5c31\u662f\u4ece\u6bcf\u4e2a\u8282\u70b9\u7684 kubelet \u90a3\u91cc\u6293\u6307\u6807&#xff0c;\u6c47\u603b\u6210 metrics.k8s.io API&#xff0c;\u4f9b kubectl top \u548c HPA \u4f7f\u7528\u3002<\/p>\n<h4>3.2 \u90e8\u7f72<\/h4>\n<p>wget -O metrics-server-components.yaml https:\/\/lcm.cloud\/class\/course-materials\/softwares\/stage03\/metrics-server-components-v0.7.1.yaml<br \/>\nsed -i &#039;s\/registry.k8s.io\/hub.lcm.cloud\/g&#039; metrics-server-components.yaml  # \u6362\u955c\u50cf<br \/>\nkubectl apply -f metrics-server-components.yaml<br \/>\nkubectl get pods -n kube-system | grep metrics              # \u7b49Pod\u53d8Running<\/p>\n<h4>3.3 \u7528\u6cd5<\/h4>\n<p>kubectl top node                                            # \u770b\u6bcf\u4e2a\u8282\u70b9\u7684CPU\/\u5185\u5b58\u4f7f\u7528\u7387<br \/>\nkubectl top pods -n kube-system                             # \u770b\u6bcf\u4e2aPod\u7684CPU\/\u5185\u5b58<\/p>\n<p>\u5355\u4f4d\u8bb0\u4f4f&#xff1a;1 CPU &#061; 1000m&#xff0c;\u6240\u4ee5 Pod \u7528\u4e86 50m \u5c31\u662f 0.05 \u6838\u3002<\/p>\n<hr \/>\n<h3>\u56db\u3001HPA&#xff08;\u6c34\u5e73\u81ea\u52a8\u6269\u7f29&#xff09;<\/h3>\n<h4>4.1 \u57fa\u672c\u6982\u5ff5<\/h4>\n<p>HPA \u76ef\u7740 Deployment&#xff0c;\u6839\u636e Pod \u7684 CPU \u6216\u5185\u5b58\u4f7f\u7528\u7387\u81ea\u52a8\u52a0\u51cf\u526f\u672c\u6570&#xff1a;<\/p>\n<ul>\n<li>CPU \u8d85\u8fc7\u9608\u503c \u2192 \u52a0 Pod\u3002<\/li>\n<li>CPU \u4f4e\u4e8e\u9608\u503c\u6301\u7eed\u4e00\u6bb5\u65f6\u95f4 \u2192 \u51cf Pod\u3002<\/li>\n<li>\u526f\u672c\u6570\u5361\u5728 minReplicas \u548c maxReplicas \u4e4b\u95f4\u3002<\/li>\n<\/ul>\n<h4>4.2 \u521b\u5efa HPA&#xff08;CPU \u6a21\u5f0f&#xff09;<\/h4>\n<p>\u5148\u8d77 Deployment&#xff1a;<\/p>\n<p>kubectl create deployment web &#8211;image&#061;hub.lcm.cloud\/library\/nginx<\/p>\n<p>\u521b\u5efa HPA&#xff1a;<\/p>\n<p>kubectl autoscale deployment web &#8211;max&#061;5 &#8211;min&#061;2 &#8211;cpu-percent&#061;80  # \u6700\u5c112\u4e2a&#xff0c;\u6700\u591a5\u4e2a&#xff0c;CPU\u8d8580%\u5c31\u6269<\/p>\n<p>\u770b HPA \u72b6\u6001&#xff1a;<\/p>\n<p>kubectl get hpa<\/p>\n<p>\u8f93\u51fa\u91cc TARGETS \u5217\u683c\u5f0f\u662f \u5f53\u524d\u503c\/\u76ee\u6807\u503c&#xff0c;\u6bd4\u5982 cpu: 0%\/80%\u3002<\/p>\n<h4>4.3 TARGETS \u4e3a\u4ec0\u4e48\u663e\u793a &lt;unknown&gt;<\/h4>\n<p>\u8fd9\u662f\u65b0\u624b\u6700\u5e38\u8e29\u7684\u5751\u3002HPA \u8981\u7b97 CPU \u767e\u5206\u6bd4&#xff0c;\u5fc5\u987b\u77e5\u9053&#034;100% \u662f\u591a\u5c11&#034;&#xff0c;\u8fd9\u4e2a\u57fa\u51c6\u5c31\u662f\u5bb9\u5668\u7684 resources.limits.cpu\u3002\u5982\u679c\u4f60\u6ca1\u5199 limits&#xff0c;HPA \u5c31\u4e0d\u77e5\u9053\u5206\u6bcd&#xff0c;\u53ea\u80fd\u663e\u793a unknown\u3002<\/p>\n<p>\u4fee\u590d&#xff1a;\u7f16\u8f91 Deployment \u52a0 resources&#xff1a;<\/p>\n<p>kubectl edit deployments.apps web<\/p>\n<p>\u5728\u5bb9\u5668\u4e0b\u9762\u52a0&#xff1a;<\/p>\n<p>    resources:<br \/>\n      limits:<br \/>\n        cpu: 100m                                             # \u8fd9\u5c31\u662f100%\u7684\u57fa\u51c6&#xff0c;\u8dd1\u6ee1100m\u5c31\u662f100%<br \/>\n        memory: 200Mi<\/p>\n<p>\u4fdd\u5b58\u540e\u6eda\u52a8\u91cd\u5efa Pod&#xff0c;\u518d kubectl get hpa&#xff0c;TARGETS \u5c31\u4ece &lt;unknown&gt;\/80% \u53d8\u6210 0%\/80% \u4e86\u3002<\/p>\n<h4>4.4 TARGETS \u600e\u4e48\u8bfb<\/h4>\n<p>NAME   REFERENCE        TARGETS              MINPODS   MAXPODS   REPLICAS<br \/>\nweb    Deployment\/web   cpu: 100%\/80%        2         5         2<\/p>\n<ul>\n<li>\u659c\u6760\u524d\u9762 100%&#xff1a;\u6240\u6709 Pod \u7684\u5e73\u5747 CPU \u5b9e\u9645\u4f7f\u7528\u7387\u3002<\/li>\n<li>\u659c\u6760\u540e\u9762 80%&#xff1a;\u4f60\u8bbe\u7684\u9608\u503c\u3002<\/li>\n<li>\u524d\u9762 &gt; \u540e\u9762 \u2192 \u6269\u5bb9&#xff1b;\u524d\u9762 &lt; \u540e\u9762 \u2192 \u51b7\u5374\u540e\u7f29\u5bb9\u3002<\/li>\n<li>REPLICAS \u662f\u5f53\u524d\u5b9e\u9645\u526f\u672c\u6570\u3002<\/li>\n<\/ul>\n<h4>4.5 \u538b\u6d4b\u770b\u6269\u5bb9<\/h4>\n<p>\u5f00\u4e00\u4e2a\u76d1\u63a7\u7a97\u53e3&#xff1a;<\/p>\n<p>while true; do clear; date; kubectl get hpa; kubectl get pod; kubectl top pods; sleep 1; done | tee hpa.log<\/p>\n<p>\u53e6\u4e00\u4e2a\u7a97\u53e3\u4e0a\u538b\u529b&#xff1a;<\/p>\n<p>apt install -y apache2-utils                                # \u88c5ab\u538b\u6d4b\u5de5\u5177<br \/>\nkubectl expose deployment web &#8211;port&#061;80 &#8211;target-port&#061;80   # \u5148\u5efaService<br \/>\nwhile true; do ab -n 300000 -c 100 http:\/\/10.100.255.92\/; sleep 1; done  # \u72c2\u6253<\/p>\n<p>\u89c2\u5bdf&#xff1a;CPU \u51b2\u5230 100% \u540e\u7ea6 20 \u79d2&#xff0c;HPA \u81ea\u52a8\u52a0\u4e00\u4e2a Pod&#xff1b;\u52a0\u5b8c\u540e\u6bcf\u4e2a Pod \u8d1f\u8f7d\u964d\u4e0b\u6765&#xff0c;TARGETS \u56de\u843d\u5230 95% \u5de6\u53f3\u3002\u4e00\u76f4\u52a0\u5230 5 \u4e2a Pod \u5c01\u9876\u3002<\/p>\n<h4>4.6 \u5185\u5b58\u6a21\u5f0f HPA&#xff08;v2 API&#xff09;<\/h4>\n<p>CPU \u7528 v1 \u5c31\u591f&#xff0c;\u5185\u5b58\u8981\u5199 v2&#xff1a;<\/p>\n<p>apiVersion: autoscaling\/v2<br \/>\nkind: HorizontalPodAutoscaler<br \/>\nmetadata:<br \/>\n  name: web<br \/>\nspec:<br \/>\n  minReplicas: 2<br \/>\n  maxReplicas: 5<br \/>\n  scaleTargetRef:<br \/>\n    apiVersion: apps\/v1<br \/>\n    kind: Deployment<br \/>\n    name: web<br \/>\n  metrics:<br \/>\n  &#8211; resource:<br \/>\n      name: memory<br \/>\n      target:<br \/>\n        type: Utilization<br \/>\n        averageUtilization: 60                              # \u5185\u5b58\u5e73\u5747\u7528\u8d8560%\u5c31\u6269<br \/>\n    type: Resource<\/p>\n<h4>4.7 HPA \u7cbe\u7ec6\u7ba1\u63a7&#xff08;scaleUp \/ scaleDown&#xff09;<\/h4>\n<p>K8s 1.18 \u4e4b\u540e\u53ef\u4ee5\u63a7\u5236\u6269\u7f29\u5bb9\u7684\u8282\u594f&#xff1a;<\/p>\n<p>\u6269\u5bb9 scaleUp&#xff1a;<\/p>\n<p>scaleUp:<br \/>\n  stabilizationWindowSeconds: 0                            # \u6269\u5bb9\u4e0d\u7b49\u5f85&#xff0c;\u7acb\u523b\u6269<br \/>\n  policies:<br \/>\n  &#8211; type: Percent<br \/>\n    value: 100                                              # \u6bcf15\u79d2\u6700\u591a\u7ffb\u500d<br \/>\n    periodSeconds: 15<br \/>\n  &#8211; type: Pods<br \/>\n    value: 4                                                # \u6bcf15\u79d2\u6700\u591a\u52a04\u4e2aPod<br \/>\n    periodSeconds: 15<br \/>\n  selectPolicy: Max                                         # \u4e24\u6761\u7b56\u7565\u53d6\u5927\u503c<\/p>\n<p>\u7f29\u5bb9 scaleDown&#xff1a;<\/p>\n<p>scaleDown:<br \/>\n  stabilizationWindowSeconds: 300                           # \u7f29\u5bb9\u51b7\u53745\u5206\u949f&#xff0c;\u9632\u6b62\u6d41\u91cf\u6296\u52a8\u6765\u56de\u6269\u7f29<br \/>\n  policies:<br \/>\n  &#8211; type: Percent<br \/>\n    value: 100<br \/>\n    periodSeconds: 15<br \/>\n  selectPolicy: Max<\/p>\n<p>\u8bb0\u5fc6\u8981\u70b9&#xff1a;<\/p>\n<ul>\n<li>\u6269\u5bb9\u9ed8\u8ba4\u7acb\u523b\u6269&#xff08;stabilization&#061;0&#xff09;&#xff0c;\u7f29\u5bb9\u9ed8\u8ba4\u7b49 5 \u5206\u949f&#xff08;stabilization&#061;300&#xff09;\u3002<\/li>\n<li>\u6269\u5bb9\u7a97\u53e3\u5185\u53d6\u6700\u5c0f\u671f\u671b\u526f\u672c\u6570&#xff0c;\u7f29\u5bb9\u7a97\u53e3\u5185\u53d6\u6700\u5927\u671f\u671b\u526f\u672c\u6570\u2014\u2014\u90fd\u662f\u4e3a\u4e86\u907f\u514d\u6296\u52a8\u3002<\/li>\n<\/ul>\n<h4>4.8 HPA vs VPA<\/h4>\n<table>\n<tr>\u9879\u76eeHPA \u6a2a\u5411VPA \u7eb5\u5411<\/tr>\n<tbody>\n<tr>\n<td align=\"left\">\u6269\u7f29\u65b9\u5f0f<\/td>\n<td align=\"left\">\u52a0\/\u51cf Pod \u6570\u91cf<\/td>\n<td align=\"left\">\u8c03 Pod \u7684 CPU\/\u5185\u5b58 request\/limit<\/td>\n<\/tr>\n<tr>\n<td align=\"left\">\u662f\u5426\u91cd\u542f Pod<\/td>\n<td align=\"left\">\u4e0d\u91cd\u542f<\/td>\n<td align=\"left\">\u4e00\u822c\u8981\u91cd\u542f<\/td>\n<\/tr>\n<tr>\n<td align=\"left\">\u9002\u7528\u573a\u666f<\/td>\n<td align=\"left\">\u6d41\u91cf\u6ce2\u52a8\u5927<\/td>\n<td align=\"left\">\u8d44\u6e90\u8bf7\u6c42\u8bbe\u5f97\u4e0d\u5408\u7406<\/td>\n<\/tr>\n<tr>\n<td align=\"left\">\u751f\u4ea7\u4f7f\u7528<\/td>\n<td align=\"left\">\u975e\u5e38\u666e\u904d<\/td>\n<td align=\"left\">\u8f83\u5c11<\/td>\n<\/tr>\n<tr>\n<td align=\"left\">\u80fd\u5426\u540c\u65f6\u5f00<\/td>\n<td align=\"left\">\u4e0d\u80fd&#xff0c;\u4f1a\u51b2\u7a81<\/td>\n<td align=\"left\">&#8211;<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<hr \/>\n<h3>\u4e94\u3001\u73af\u5883\u6e05\u7406<\/h3>\n<p>kubectl delete ns scheduler                                 # \u5220\u8c03\u5ea6\u5b9e\u9a8c\u547d\u540d\u7a7a\u95f4<br \/>\nkubectl delete ns metric                                    # \u5220Metric Server\/HPA\u5b9e\u9a8c\u547d\u540d\u7a7a\u95f4<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Kubernetes \u8c03\u5ea6\u5668\u3001Metric Server \u4e0e HPA \u5c0f\u767d\u6559\u7a0b\u8fd9\u8282\u8bb2\u4e24\u4ef6\u4e8b&#xff1a;\u2460 Pod \u521b\u5efa\u51fa\u6765\u540e&#xff0c;kube-scheduler \u51ed\u4ec0\u4e48\u51b3\u5b9a\u628a\u5b83\u6254\u5230\u54ea\u4e2a\u8282\u70b9&#xff1b;\u2461 \u600e\u4e48\u6839\u636e Pod \u7684 CPU\/\u5185\u5b58\u4f7f\u7528\u7387\u81ea\u52a8\u6269\u7f29\u526f\u672c\u6570&#xff08;HPA&#xff09;\u3002\u4e00\u3001Pod \u8c03\u5ea6\u5168\u6d41\u7a0b<br \/>\n1.1 \u76f4\u63a5\u521b\u5efa Pod \u7684\u4e03\u6b65\u8d70<br \/>\n\u5ba2\u6237\u7aef\u53d1\u8bf7\u6c42\u7ed9 kube-apiserver\u3002apiserver \u505a\u8ba4\u8bc1\u3001\u6388\u6743\u3001\u51c6\u5165\u6821\u9a8c&#xff0c;\u901a<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[120,763,121,43,78],"topic":[],"class_list":["post-118636","post","type-post","status-publish","format-standard","hentry","category-server","tag-kubernetes","tag-763","tag-121","tag-43","tag-78"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>1027 Kubernetes\u8c03\u5ea6\u5668MetricServer\u4e0eHPA\u5c0f\u767d\u6559\u7a0b - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/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.wsisp.com\/helps\/118636.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"1027 Kubernetes\u8c03\u5ea6\u5668MetricServer\u4e0eHPA\u5c0f\u767d\u6559\u7a0b - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"Kubernetes \u8c03\u5ea6\u5668\u3001Metric Server \u4e0e HPA \u5c0f\u767d\u6559\u7a0b\u8fd9\u8282\u8bb2\u4e24\u4ef6\u4e8b&#xff1a;\u2460 Pod \u521b\u5efa\u51fa\u6765\u540e&#xff0c;kube-scheduler \u51ed\u4ec0\u4e48\u51b3\u5b9a\u628a\u5b83\u6254\u5230\u54ea\u4e2a\u8282\u70b9&#xff1b;\u2461 \u600e\u4e48\u6839\u636e Pod \u7684 CPU\/\u5185\u5b58\u4f7f\u7528\u7387\u81ea\u52a8\u6269\u7f29\u526f\u672c\u6570&#xff08;HPA&#xff09;\u3002\u4e00\u3001Pod \u8c03\u5ea6\u5168\u6d41\u7a0b 1.1 \u76f4\u63a5\u521b\u5efa Pod \u7684\u4e03\u6b65\u8d70 \u5ba2\u6237\u7aef\u53d1\u8bf7\u6c42\u7ed9 kube-apiserver\u3002apiserver \u505a\u8ba4\u8bc1\u3001\u6388\u6743\u3001\u51c6\u5165\u6821\u9a8c&#xff0c;\u901a\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/118636.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-10-27T14:16:33+00:00\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/118636.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/118636.html\",\"name\":\"1027 Kubernetes\u8c03\u5ea6\u5668MetricServer\u4e0eHPA\u5c0f\u767d\u6559\u7a0b - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-10-27T14:16:33+00:00\",\"dateModified\":\"2026-10-27T14:16:33+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/118636.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/118636.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/118636.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"1027 Kubernetes\u8c03\u5ea6\u5668MetricServer\u4e0eHPA\u5c0f\u767d\u6559\u7a0b\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"1027 Kubernetes\u8c03\u5ea6\u5668MetricServer\u4e0eHPA\u5c0f\u767d\u6559\u7a0b - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","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.wsisp.com\/helps\/118636.html","og_locale":"zh_CN","og_type":"article","og_title":"1027 Kubernetes\u8c03\u5ea6\u5668MetricServer\u4e0eHPA\u5c0f\u767d\u6559\u7a0b - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"Kubernetes \u8c03\u5ea6\u5668\u3001Metric Server \u4e0e HPA \u5c0f\u767d\u6559\u7a0b\u8fd9\u8282\u8bb2\u4e24\u4ef6\u4e8b&#xff1a;\u2460 Pod \u521b\u5efa\u51fa\u6765\u540e&#xff0c;kube-scheduler \u51ed\u4ec0\u4e48\u51b3\u5b9a\u628a\u5b83\u6254\u5230\u54ea\u4e2a\u8282\u70b9&#xff1b;\u2461 \u600e\u4e48\u6839\u636e Pod \u7684 CPU\/\u5185\u5b58\u4f7f\u7528\u7387\u81ea\u52a8\u6269\u7f29\u526f\u672c\u6570&#xff08;HPA&#xff09;\u3002\u4e00\u3001Pod \u8c03\u5ea6\u5168\u6d41\u7a0b 1.1 \u76f4\u63a5\u521b\u5efa Pod \u7684\u4e03\u6b65\u8d70 \u5ba2\u6237\u7aef\u53d1\u8bf7\u6c42\u7ed9 kube-apiserver\u3002apiserver \u505a\u8ba4\u8bc1\u3001\u6388\u6743\u3001\u51c6\u5165\u6821\u9a8c&#xff0c;\u901a","og_url":"https:\/\/www.wsisp.com\/helps\/118636.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-10-27T14:16:33+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"5 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/118636.html","url":"https:\/\/www.wsisp.com\/helps\/118636.html","name":"1027 Kubernetes\u8c03\u5ea6\u5668MetricServer\u4e0eHPA\u5c0f\u767d\u6559\u7a0b - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-10-27T14:16:33+00:00","dateModified":"2026-10-27T14:16:33+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/118636.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/118636.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/118636.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"1027 Kubernetes\u8c03\u5ea6\u5668MetricServer\u4e0eHPA\u5c0f\u767d\u6559\u7a0b"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/118636","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=118636"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/118636\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=118636"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=118636"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=118636"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=118636"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}