{"id":1480,"date":"2019-11-27T12:07:47","date_gmt":"2019-11-27T09:07:47","guid":{"rendered":"https:\/\/artem.services\/?p=1480"},"modified":"2019-11-27T13:02:08","modified_gmt":"2019-11-27T10:02:08","slug":"kubernetes-horizontal-pod-autoscaler-%d0%bd%d0%b0-%d0%be%d1%81%d0%bd%d0%be%d0%b2%d0%b5-%d0%ba%d0%b0%d1%81%d1%82%d0%be%d0%bc%d0%bd%d1%8b%d1%85-%d0%bc%d0%b5%d1%82%d1%80%d0%b8%d0%ba","status":"publish","type":"post","link":"https:\/\/artem.services\/?p=1480","title":{"rendered":"Kubernetes &#8212; Horizontal pod autoscaler \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u0445 \u043c\u0435\u0442\u0440\u0438\u043a"},"content":{"rendered":"<p><img loading=\"lazy\" class=\"aligncenter size-full wp-image-149\" src=\"https:\/\/artem.services\/wp-content\/uploads\/2018\/10\/Kubernetes-Logo.png\" alt=\"\" width=\"844\" height=\"217\" srcset=\"https:\/\/artem.services\/wp-content\/uploads\/2018\/10\/Kubernetes-Logo.png 844w, https:\/\/artem.services\/wp-content\/uploads\/2018\/10\/Kubernetes-Logo-300x77.png 300w, https:\/\/artem.services\/wp-content\/uploads\/2018\/10\/Kubernetes-Logo-768x197.png 768w\" sizes=\"(max-width: 844px) 100vw, 844px\" \/><\/p>\n<p>\u0421\u043f\u0430\u0441\u0438\u0431\u043e <strong>Daniel Vaughan<\/strong> \u0437\u0430 \u0434\u0430\u043d\u043d\u0443\u044e <a href=\"https:\/\/levelup.gitconnected.com\/building-kubernetes-apps-with-custom-scaling-a-gentle-introduction-a332d7ebc795\" target=\"_blank\" rel=\"noopener noreferrer\">\u0441\u0442\u0430\u0442\u044c\u044e<\/a>.<\/p>\n<p>\u0414\u043b\u044f \u0433\u043e\u0440\u0438\u0437\u043e\u043d\u0442\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0430\u0432\u0442\u043e\u0441\u043a\u0430\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u043e\u0434\u043e\u0432 (<strong>HPA<\/strong>) \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u0445 \u043c\u0435\u0442\u0440\u0438\u043a, \u043d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u044f\u0442\u0441\u044f:<\/p>\n<ul>\n<li><a href=\"https:\/\/github.com\/helm\/charts\/tree\/master\/stable\/prometheus-operator\" target=\"_blank\" rel=\"noopener noreferrer\">Prometheus Operator<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/helm\/charts\/tree\/master\/stable\/prometheus-adapter\" target=\"_blank\" rel=\"noopener noreferrer\">Prometheus Adapter<\/a><\/li>\n<\/ul>\n<p>\u0412\u0441\u0435 \u044d\u0442\u043e, \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f <strong>Helm<\/strong>. \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0443 <strong>Helm<\/strong>&#39;\u0430 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c <a href=\"https:\/\/artem.services\/?p=419\" target=\"_blank\" rel=\"noopener noreferrer\">\u0442\u0443\u0442<\/a>.<\/p>\n<p>&nbsp;<\/p>\n<p>\u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044e \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f <strong>Helm values<\/strong>:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nmkdir helm-values\r\n<\/pre>\n<p>&nbsp;<\/p>\n<p>\u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c <strong>values<\/strong> \u0444\u0430\u0439\u043b \u0434\u043b\u044f <strong>Prometheus Operator<\/strong>&#39;\u0430:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\ncat &lt;&lt;EOF &gt;helm-values\/prometheus-operator-values.yaml\r\n# This configuration means all ServiceMonitors in the namespace will be picked up\r\n# Use with caution!\r\nprometheus: \r\n  prometheusSpec:\r\n    serviceMonitorSelectorNilUsesHelmValues: false\r\n    serviceMonitorSelector: {}\r\nEOF\r\n<\/pre>\n<p>&nbsp;<\/p>\n<p>\u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c <strong>Prometheus Operator<\/strong>:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nhelm install stable\/prometheus-operator -n prom \\\r\n    -f helm-values\/prometheus-operator-values.yaml\r\n<\/pre>\n<p>&nbsp;<\/p>\n<p><!--more--><\/p>\n<p>&nbsp;<\/p>\n<p>\u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c <strong>values<\/strong> \u0444\u0430\u0439\u043b \u0434\u043b\u044f <strong>Prometheus Adapter<\/strong>&#39;\u0430:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\ncat &lt;&lt;EOF &gt;helm-values\/prometheus-adapter-values.yaml\r\nrules:\r\n  default: false\r\n  custom:\r\n  - seriesQuery: 'demo_app_button_clicks_total'\r\n    resources: { template: &quot;&lt;&lt;.Resource&gt;&gt;&quot; }\r\n    name:\r\n      matches: &quot;^(.*)_total&quot;\r\n      as: &quot;${1}_per_second&quot;\r\n    metricsQuery: &quot;sum(rate(&lt;&lt;.Series&gt;&gt;{&lt;&lt;.LabelMatchers&gt;&gt;}[2m])) by (&lt;&lt;.GroupBy&gt;&gt;)&quot;\r\nprometheus:\r\n  url: http:\/\/prom-prometheus-operator-prometheus.default\r\nEOF\r\n<\/pre>\n<p>&nbsp;<\/p>\n<blockquote><p>\u0422\u0443\u0442 \u043c\u044b \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c, \u0447\u0442\u043e \u043d\u0430\u043c \u043d\u0435 \u043d\u0443\u0436\u043d\u044b \u043f\u0440\u0435\u0434\u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u0435 \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u0435 \u043c\u0435\u0442\u0440\u0438\u043a\u0438, \u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0441\u0432\u043e\u044e. \u0418 \u0432\u0430\u0436\u043d\u043e, \u0447\u0442\u043e\u0431\u044b <strong>URL<\/strong> \u0441\u0435\u0440\u0432\u0438\u0441\u0430 &quot;<strong>Prometheus Operator<\/strong>&quot; \u0431\u044b\u043b \u0443\u043a\u0430\u0437\u0430\u043d \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u043c<\/p><\/blockquote>\n<p>&nbsp;<\/p>\n<p>\u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c <strong>Prometheus Adapter<\/strong>:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nhelm install stable\/prometheus-adapter -n prom-adapter \\\r\n    -f helm-values\/prometheus-adapter-values.yaml\r\n<\/pre>\n<p>&nbsp;<\/p>\n<p>\u0427\u0435\u0440\u0435\u0437 \u043c\u0438\u043d\u0443\u0442\u0443-\u0434\u0432\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c, \u0447\u0442\u043e <strong>API<\/strong> \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u0445 \u043c\u0435\u0442\u0440\u0438\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nkubectl get --raw &quot;\/apis\/custom.metrics.k8s.io\/v1beta1\/&quot; | jq .\r\n{\r\n  &quot;kind&quot;: &quot;APIResourceList&quot;,\r\n  &quot;apiVersion&quot;: &quot;v1&quot;,\r\n  &quot;groupVersion&quot;: &quot;custom.metrics.k8s.io\/v1beta1&quot;,\r\n  &quot;resources&quot;: []\r\n}\r\n<\/pre>\n<p>&nbsp;<\/p>\n<blockquote><p>\u041d\u0430 \u0434\u0430\u043d\u043d\u043e\u043c \u044d\u0442\u0430\u043f\u0435 \u043c\u044b \u0442\u0443\u0442 \u043d\u0435 \u0432\u0438\u0434\u0438\u043c \u043d\u0430\u0448\u0443 \u043c\u0435\u0442\u0440\u0438\u043a\u0443 &quot;<strong>demo_app_button_clicks_total<\/strong>&quot;, \u0442\u0430\u043a \u0438 \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c, \u0432\u0435\u0434\u044c \u043c\u044b \u0442\u043e\u043b\u044c\u043a\u043e <strong>Prometheus Adapter<\/strong>&#39;\u0443 \u0443\u043a\u0430\u0437\u0430\u043b\u0438 \u043a\u0430\u043a \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0435\u0435.<\/p><\/blockquote>\n<p>&nbsp;<\/p>\n<p>\u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c <strong>deployment<\/strong> \u0438 <strong>service<\/strong> \u0434\u043b\u044f \u043d\u0430\u0448\u0435\u0433\u043e \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\ncat &lt;&lt;EOF | kubectl apply -f -\r\napiVersion: apps\/v1\r\nkind: Deployment\r\nmetadata:\r\n  name: demo-app\r\n  labels:\r\n    app: demo-app\r\nspec:\r\n  selector:\r\n    matchLabels:\r\n      app: demo-app\r\n  template:\r\n    metadata:\r\n      labels:\r\n        app: demo-app\r\n    spec:\r\n      containers:\r\n      - name: demo-app\r\n        image: flipstone42\/k8s-prometheus-custom-scaling:latest\r\n        resources:\r\n          limits:\r\n            memory: &quot;128Mi&quot;\r\n            cpu: &quot;100m&quot;\r\n        ports:\r\n        - containerPort: 8000\r\n          name: http\r\n---\r\napiVersion: v1\r\nkind: Service\r\nmetadata:\r\n  name: demo-app\r\n  labels:\r\n    app: demo-app\r\nspec:\r\n  type: ClusterIP\r\n  selector:\r\n    app: demo-app\r\n  ports:\r\n  - port: 8080\r\n    targetPort: 8000\r\n    name: web\r\nEOF\r\n<\/pre>\n<p>&nbsp;<\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c <strong>HPA<\/strong> \u0434\u043b\u044f \u043d\u0430\u0448\u0435\u0433\u043e <strong>deployment<\/strong>&#39;\u0430:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\ncat &lt;&lt;EOF | kubectl apply -f -\r\nkind: HorizontalPodAutoscaler\r\napiVersion: autoscaling\/v2beta1\r\nmetadata:\r\n  name: demo-app\r\nspec:\r\n  scaleTargetRef:\r\n    apiVersion: apps\/v1\r\n    kind: Deployment\r\n    name: demo-app\r\n  # autoscale between 1 and 10 replicas\r\n  minReplicas: 1\r\n  maxReplicas: 10\r\n  metrics:\r\n  # use a &quot;Pods&quot; metric, which takes the average of the\r\n  # given metric across all pods controlled by the autoscaling target\r\n  - type: Pods\r\n    pods:\r\n      metricName: demo_app_button_clicks_per_second\r\n      targetAverageValue: 10m\r\nEOF\r\n<\/pre>\n<p>&nbsp;<\/p>\n<blockquote><p>\u0422\u0443\u0442 \u0433\u043b\u0430\u0432\u043d\u043e\u0435 \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u0438\u043c\u044f <strong>Deployment<\/strong>&#39;\u0430 \u0438 \u0438\u043c\u044f \u043c\u0435\u0442\u0440\u0438\u043a\u0438, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043e\u0442\u0434\u0430\u0435\u0442 \u043d\u0430\u0448\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435.<\/p><\/blockquote>\n<p>&nbsp;<\/p>\n<p>\u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c <strong>ServiceMonitor<\/strong> \u0434\u043b\u044f \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u043d\u0438\u044f \u043d\u0430\u0448\u0435\u0439 \u043c\u0435\u0442\u0440\u0438\u043a\u0438:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\ncat &lt;&lt;EOF | kubectl apply -f -\r\napiVersion: monitoring.coreos.com\/v1\r\nkind: ServiceMonitor\r\nmetadata:\r\n  name: demo-app\r\nspec:\r\n  endpoints:\r\n  - bearerTokenFile: \/var\/run\/secrets\/kubernetes.io\/serviceaccount\/token\r\n    interval: 15s\r\n    port: web\r\n  selector:\r\n    matchLabels:\r\n      app: demo-app\r\nEOF\r\n<\/pre>\n<p>&nbsp;<\/p>\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c <strong>HPA<\/strong>. \u0415\u0441\u043b\u0438 \u0432 \u0441\u0442\u043e\u043b\u0431\u0446\u0435 &quot;<strong>TARGETS<\/strong>&quot; \u0432\u044b \u0432\u0438\u0434\u0438\u0442\u0435 &quot;<strong>0\/10m<\/strong>&quot;, \u0430 \u043d\u0435 &quot;<strong>&lt;unknown&gt;\/10m<\/strong>&quot;, \u0437\u043d\u0430\u0447\u0438\u0442 \u043c\u0435\u0442\u0440\u0438\u043a\u0430 \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u0442\u0441\u044f.<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nkubectl get hpa demo-app \r\nNAME       REFERENCE             TARGETS   MINPODS   MAXPODS   REPLICAS   AGE\r\ndemo-app   Deployment\/demo-app   0\/10m     1         10        1          1m\r\n<\/pre>\n<p>&nbsp;<\/p>\n<p>\u0412\u044b\u043f\u043e\u043b\u043d\u0438\u043c <strong>describe HPA<\/strong> \u0447\u0442\u043e\u0431\u044b \u043e\u043a\u043e\u043d\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0443\u0431\u0435\u0434\u0438\u0442\u0441\u044f, \u0447\u0442\u043e \u043c\u0435\u0442\u0440\u0438\u043a\u0430 \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u0442\u0441\u044f.<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nkubectl describe hpa demo-app\r\nName:                                           demo-app\r\nNamespace:                                      default\r\nLabels:                                         &lt;none&gt;\r\nAnnotations:                                    kubectl.kubernetes.io\/last-applied-configuration:\r\n                                                  {&quot;apiVersion&quot;:&quot;autoscaling\/v2beta1&quot;,&quot;kind&quot;:&quot;HorizontalPodAutoscaler&quot;,&quot;metadata&quot;:{&quot;annotations&quot;:{},&quot;name&quot;:&quot;demo-app&quot;,&quot;namespace&quot;:&quot;default&quot;}...\r\nCreationTimestamp:                              Tue, 26 Nov 2019 20:51:36 +0000\r\nReference:                                      Deployment\/demo-app\r\nMetrics:                                        ( current \/ target )\r\n  &quot;demo_app_button_clicks_per_second&quot; on pods:  0 \/ 10m\r\nMin replicas:                                   1\r\nMax replicas:                                   10\r\nDeployment pods:                                1 current \/ 1 desired\r\nConditions:\r\n  Type            Status  Reason            Message\r\n  ----            ------  ------            -------\r\n  AbleToScale     True    ReadyForNewScale  recommended size matches current size\r\n  ScalingActive   True    ValidMetricFound  the HPA was able to successfully calculate a replica count from pods metric demo_app_button_clicks_per_second\r\n  ScalingLimited  True    TooFewReplicas    the desired replica count is less than the minimum replica count\r\nEvents:           &lt;none&gt;\r\n<\/pre>\n<p>&nbsp;<\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043c\u043e\u0436\u0435\u043c \u0432\u0438\u0434\u0435\u0442\u044c \u043d\u0430\u0448\u0443 \u043c\u0435\u0442\u0440\u0438\u043a\u0443 \u0432 <strong>Custom Metrics API<\/strong>:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nkubectl get --raw \/apis\/custom.metrics.k8s.io\/v1beta1 | jq .\r\n{\r\n  &quot;kind&quot;: &quot;APIResourceList&quot;,\r\n  &quot;apiVersion&quot;: &quot;v1&quot;,\r\n  &quot;groupVersion&quot;: &quot;custom.metrics.k8s.io\/v1beta1&quot;,\r\n  &quot;resources&quot;: [\r\n    {\r\n      &quot;name&quot;: &quot;pods\/demo_app_button_clicks_per_second&quot;,\r\n      &quot;singularName&quot;: &quot;&quot;,\r\n      &quot;namespaced&quot;: true,\r\n      &quot;kind&quot;: &quot;MetricValueList&quot;,\r\n      &quot;verbs&quot;: [\r\n        &quot;get&quot;\r\n      ]\r\n    },\r\n    {\r\n      &quot;name&quot;: &quot;services\/demo_app_button_clicks_per_second&quot;,\r\n      &quot;singularName&quot;: &quot;&quot;,\r\n      &quot;namespaced&quot;: true,\r\n      &quot;kind&quot;: &quot;MetricValueList&quot;,\r\n      &quot;verbs&quot;: [\r\n        &quot;get&quot;\r\n      ]\r\n    },\r\n    {\r\n      &quot;name&quot;: &quot;jobs.batch\/demo_app_button_clicks_per_second&quot;,\r\n      &quot;singularName&quot;: &quot;&quot;,\r\n      &quot;namespaced&quot;: true,\r\n      &quot;kind&quot;: &quot;MetricValueList&quot;,\r\n      &quot;verbs&quot;: [\r\n        &quot;get&quot;\r\n      ]\r\n    },\r\n    {\r\n      &quot;name&quot;: &quot;namespaces\/demo_app_button_clicks_per_second&quot;,\r\n      &quot;singularName&quot;: &quot;&quot;,\r\n      &quot;namespaced&quot;: false,\r\n      &quot;kind&quot;: &quot;MetricValueList&quot;,\r\n      &quot;verbs&quot;: [\r\n        &quot;get&quot;\r\n      ]\r\n    }\r\n  ]\r\n}\r\n<\/pre>\n<p>&nbsp;<\/p>\n<p>\u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0434\u043b\u044f \u043d\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f <strong>Ingress<\/strong>:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\ncat &lt;&lt;EOF | kubectl apply -f -\r\napiVersion: extensions\/v1beta1\r\nkind: Ingress\r\nmetadata:\r\n  annotations:\r\n    kubernetes.io\/ingress.class: nginx\r\n  name: demo\r\n  namespace: default\r\nspec:\r\n  rules:\r\n    - host: demo.artem.services\r\n      http:\r\n        paths:\r\n          - backend:\r\n              serviceName: demo-app\r\n              servicePort: 8080\r\n            path: \/\r\nEOF\r\n<\/pre>\n<p>&nbsp;<\/p>\n<p>\u041f\u0435\u0440\u0435\u0439\u0434\u0435\u043c \u043f\u043e <strong>URL<\/strong> \u043d\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f:<\/p>\n<p><img loading=\"lazy\" class=\"aligncenter size-full wp-image-1486\" src=\"https:\/\/artem.services\/wp-content\/uploads\/2019\/11\/003-1.png\" alt=\"\" width=\"1107\" height=\"624\" srcset=\"https:\/\/artem.services\/wp-content\/uploads\/2019\/11\/003-1.png 1107w, https:\/\/artem.services\/wp-content\/uploads\/2019\/11\/003-1-300x169.png 300w, https:\/\/artem.services\/wp-content\/uploads\/2019\/11\/003-1-1024x577.png 1024w, https:\/\/artem.services\/wp-content\/uploads\/2019\/11\/003-1-768x433.png 768w, https:\/\/artem.services\/wp-content\/uploads\/2019\/11\/003-1-954x538.png 954w\" sizes=\"(max-width: 1107px) 100vw, 1107px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>\u041a\u043b\u0438\u043a\u043d\u0435\u043c \u043f\u043e \u043a\u043d\u043e\u043f\u043a\u0435 &quot;<strong>Hit me!<\/strong>&quot; \u043f\u044f\u0442\u044c \u0440\u0430\u0437 (\u0447\u0442\u043e\u0431\u044b \u0441\u0440\u0430\u0437\u0443 \u043d\u0435 \u0441\u043a\u0430\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u0434\u044b \u0432 \u043c\u0430\u043a\u0441\u0438\u043c\u0443\u043c)<\/p>\n<p>&nbsp;<\/p>\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c <strong>HPA<\/strong>:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nkubectl get hpa demo-app\r\nNAME       REFERENCE             TARGETS   MINPODS   MAXPODS   REPLICAS   AGE\r\ndemo-app   Deployment\/demo-app   38m\/10m   1         10        1          10m\r\n<\/pre>\n<p>&nbsp;<\/p>\n<p>\u0418 \u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e <strong>Pod<\/strong>&#39;\u043e\u0432:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nkubectl get po -l app=demo-app\r\nNAME                        READY   STATUS    RESTARTS   AGE\r\ndemo-app-78c7869955-9vzsr   1\/1     Running   0          2m50s\r\ndemo-app-78c7869955-fgnsx   1\/1     Running   0          2m50s\r\ndemo-app-78c7869955-sl9f8   1\/1     Running   0          2m50s\r\ndemo-app-78c7869955-zxrtt   1\/1     Running   0          13m\r\n<\/pre>\n<p>&nbsp;<\/p>\n<blockquote><p>\u0427\u0435\u0440\u0435\u0437 10 \u043c\u0438\u043d\u0443\u0442, \u043f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e \u043a\u0430\u043a \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043c\u0435\u0442\u0440\u0438\u043a\u0438 \u043e\u043f\u0443\u0441\u0442\u0438\u0442\u0441\u044f, <strong>Pod<\/strong>&#39;\u044b \u043d\u0430\u0447\u043d\u0443\u0442 \u0441\u043a\u0430\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0432 \u043e\u0431\u0440\u0430\u0442\u043d\u0443\u044e \u0441\u0442\u043e\u0440\u043e\u043d\u0443.<\/p><\/blockquote>\n<p>&nbsp;<\/p>\n<h3>Trableshooting<\/h3>\n<p>\u0415\u0441\u043b\u0438 \u0432\u044b \u0432\u0441\u0435 \u0441\u0434\u0435\u043b\u0430\u043b\u0438 \u0432\u0435\u0440\u043d\u043e, \u043d\u043e \u0443 \u0432\u0430\u0441 \u043d\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u0435 \u043c\u0435\u0442\u0440\u0438\u043a\u0438, \u0443\u0431\u0435\u0434\u0438\u0442\u0435\u0441\u044c, \u0447\u0442\u043e \u0443 \u0432\u0430\u0441 \u0432\u043a\u043b\u044e\u0447\u0435\u043d <strong>Aggregation API<\/strong>:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nkubectl get pod kube-apiserver-master -n kube-system -o yaml\r\n\r\nspec:\r\n  containers:\r\n  - command:\r\n...\r\n    - --requestheader-client-ca-file=\/etc\/kubernetes\/pki\/front-proxy-ca.crt\r\n    - --requestheader-allowed-names=front-proxy-client\r\n    - --requestheader-extra-headers-prefix=X-Remote-Extra-\r\n    - --requestheader-group-headers=X-Remote-Group\r\n    - --requestheader-username-headers=X-Remote-User\r\n    - --proxy-client-key-file=\/etc\/kubernetes\/pki\/sa.key\r\n    - --proxy-client-cert-file=\/etc\/kubernetes\/pki\/ca.crt\r\n...\r\n<\/pre>\n<p>&nbsp;<\/p>\n<p>\u0422\u0430\u043a \u0436\u0435 \u043c\u043e\u0433\u0443\u0442 \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0444\u043b\u0430\u0433\u0438 \u0434\u043b\u044f <strong>Kubelet<\/strong>&#39;\u0430:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nsudo cat \/var\/lib\/kubelet\/kubeadm-flags.env\r\n\r\n... --anonymous-auth=false --authorization-mode=Webhook --authentication-token-webhook=true\r\n<\/pre>\n<p>&nbsp;<\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0444\u043b\u0430\u0433\u043e\u0432, \u043d\u0435 \u0437\u0430\u0431\u0443\u0434\u044c\u0442\u0435 \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c <strong>Kubelet<\/strong>:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nsudo systemctl restart kubelet\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u0421\u043f\u0430\u0441\u0438\u0431\u043e Daniel Vaughan \u0437\u0430 \u0434\u0430\u043d\u043d\u0443\u044e \u0441\u0442\u0430\u0442\u044c\u044e. \u0414\u043b\u044f \u0433\u043e\u0440\u0438\u0437\u043e\u043d\u0442\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0430\u0432\u0442\u043e\u0441\u043a\u0430\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u043e\u0434\u043e\u0432 (HPA) \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u0445 \u043c\u0435\u0442\u0440\u0438\u043a, \u043d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u044f\u0442\u0441\u044f: Prometheus Operator Prometheus Adapter \u0412\u0441\u0435 \u044d\u0442\u043e, \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f Helm. \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0443 Helm&#39;\u0430 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0442\u0443\u0442. &nbsp; \u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044e \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f Helm values: &nbsp; \u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c values \u0444\u0430\u0439\u043b \u0434\u043b\u044f Prometheus Operator&#39;\u0430: &nbsp; \u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c Prometheus Operator: &nbsp;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[20],"tags":[1177,1175,1173,18,17,77,1179],"_links":{"self":[{"href":"https:\/\/artem.services\/index.php?rest_route=\/wp\/v2\/posts\/1480"}],"collection":[{"href":"https:\/\/artem.services\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/artem.services\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/artem.services\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/artem.services\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1480"}],"version-history":[{"count":8,"href":"https:\/\/artem.services\/index.php?rest_route=\/wp\/v2\/posts\/1480\/revisions"}],"predecessor-version":[{"id":1489,"href":"https:\/\/artem.services\/index.php?rest_route=\/wp\/v2\/posts\/1480\/revisions\/1489"}],"wp:attachment":[{"href":"https:\/\/artem.services\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1480"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/artem.services\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1480"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/artem.services\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1480"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}