Compare languages | Модуль vertical-pod-autoscaler: FAQ

Как посмотреть рекомендации Vertical Pod Autoscaler?

How do I view the Vertical Pod Autoscaler recommendations?

После создания кастомного ресурса VerticalPodAutoscaler посмотреть рекомендации VPA можно следующим образом:

You can view the VPA recommendations after the VerticalPodAutoscaler custom resource is created using the following command:

shell kubectl describe vpa my-app-vpa

shell kubectl describe vpa my-app-vpa

В секции status отобразятся параметры:

The status will have the following parameters:

  • Target — количество ресурсов, которое будет оптимальным для пода (в пределах resourcePolicy);
  • Lower Bound — минимальное рекомендуемое количество ресурсов для более или менее (но не гарантированно) хорошей работы приложения;
  • Upper Bound — максимальное рекомендуемое количество ресурсов. Скорее всего, ресурсы, выделенные сверх этого значения, идут в мусорку и совсем никогда не нужны приложению;
  • Uncapped Target — рекомендуемое количество ресурсов в самый последний момент, то есть данное значение считается на основе самых крайних метрик, не смотря на историю ресурсов за весь период.
  • Target — the optimal amount of resources for the Pod (within the resourcePolicy).
  • Lower Bound — the minimum recommended amount of resources for the regular operation of the application.
  • Upper Bound — the maximum recommended amount of resources. Most likely, the resources above this upper bound will never be used by the application.
  • Uncapped Target — the recommended amount of resources based on the latest metrics (the history of resource usage is ignored).

Как Vertical Pod Autoscaler работает с лимитами?

How does Vertical Pod Autoscaler handle limits?

Пример 1

Example No. 1

В примере представлен VPA-объект:

The following example shows a VPA object:

yaml

apiVersion: autoscaling.k8s.io/v1 kind: VerticalPodAutoscaler metadata: name: test2 spec: targetRef: apiVersion: “apps/v1” kind: Deployment name: test2 updatePolicy: updateMode: “Initial”

yaml

apiVersion: autoscaling.k8s.io/v1 kind: VerticalPodAutoscaler metadata: name: test2 spec: targetRef: apiVersion: “apps/v1” kind: Deployment name: test2 updatePolicy: updateMode: “Initial”

В VPA-объекте представлен под с ресурсами:

The VPA object contains a Pod with the following resources:

yaml resources: limits: cpu: 2 requests: cpu: 1

yaml resources: limits: cpu: 2 requests: cpu: 1

Если контейнер использует весь CPU, и VPA рекомендует этому контейнеру 1.168 CPU, то отношение между запросами и ограничениями будет равно 100%. В этом случае при пересоздании пода VPA модифицирует его и проставит такие ресурсы:

If a container uses all the CPU, and VPA recommends 1.168 CPU for that container, then the ratio between requests and limits will be 100%. In this case, when recreating the Pod, VPA will modify it and set the following resources:

yaml resources: limits: cpu: 2336m requests: cpu: 1168m

yaml resources: limits: cpu: 2336m requests: cpu: 1168m

Пример 2

Example No. 2

В примере представлен VPA-объект:

The following example shows a VPA object:

yaml

apiVersion: autoscaling.k8s.io/v1 kind: VerticalPodAutoscaler metadata: name: test2 spec: targetRef: apiVersion: “apps/v1” kind: Deployment name: test2 updatePolicy: updateMode: “Initial”

yaml

apiVersion: autoscaling.k8s.io/v1 kind: VerticalPodAutoscaler metadata: name: test2 spec: targetRef: apiVersion: “apps/v1” kind: Deployment name: test2 updatePolicy: updateMode: “Initial”

В VPA-объекте представлен под с ресурсами:

The VPA object contains a pod with resources:

yaml resources: limits: cpu: 1 requests: cpu: 750m

yaml resources: limits: cpu: 1 requests: cpu: 750m

Если отношение запросов и ограничений равно 25%, и VPA рекомендует 1.168 CPU для контейнера, VPA изменит ресурсы контейнера следующим образом:

If the request-to-limit ratio is 25% and VPA recommends 1.168 CPU for the container, VPA will change the container resources as follows:

yaml resources: limits: cpu: 1557m requests: cpu: 1168m

yaml resources: limits: cpu: 1557m requests: cpu: 1168m

Если необходимо ограничить максимальное количество ресурсов, которые могут быть выделены для ограничений контейнера, нужно использовать в спецификации объекта VPA maxAllowed или использовать Limit Range объекта Kubernetes.

If you need to limit the maximum number of resources that can be allocated to container constraints, you should use maxAllowed in the VPA object specification or use the Limit Range of the Kubernetes object.