website icon indicating copy to clipboard operation
website copied to clipboard

Issue with k8s.io/docs/tasks/run-application/horizontal-pod-autoscale-walkthrough/

Open Skull0ne opened this issue 7 years ago • 13 comments

This is a... Need correction in the doc

Problem: I tried to apply this configuration from the doc :

type: Object
object:
  metric:
    name: requests-per-second
  describedObject:
    apiVersion: extensions/v1beta1
    kind: Ingress
    name: main-route
  target:
    type: Value
    value: 2k

Those parameters are not working :

  • metric: {name : requests-per-second}
  • describedObject
error: error validating "hello_world.yml": error validating data: [ValidationError(HorizontalPodAutoscaler.spec.metrics[2].object): unknown field "describedObject" in io.k8s.api.autoscaling.v2beta1.ObjectMetricSource, ValidationError(HorizontalPodAutoscaler.spec.metrics[2].object): unknown field "metric" in io.k8s.api.autoscaling.v2beta1.ObjectMetricSource, ValidationError(HorizontalPodAutoscaler.spec.metrics[2].object.target): unknown field "type" in io.k8s.api.autoscaling.v2beta1.CrossVersionObjectReference, ValidationError(HorizontalPodAutoscaler.spec.metrics[2].object.target): unknown field "value" in io.k8s.api.autoscaling.v2beta1.CrossVersionObjectReference, ValidationError(HorizontalPodAutoscaler.spec.metrics[2].object.target): missing required field "kind" in io.k8s.api.autoscaling.v2beta1.CrossVersionObjectReference, ValidationError(HorizontalPodAutoscaler.spec.metrics[2].object.target): missing required field "name" in io.k8s.api.autoscaling.v2beta1.CrossVersionObjectReference, ValidationError(HorizontalPodAutoscaler.spec.metrics[2].object): missing required field "metricName" in io.k8s.api.autoscaling.v2beta1.ObjectMetricSource, ValidationError(HorizontalPodAutoscaler.spec.metrics[2].object): missing required field "targetValue" in io.k8s.api.autoscaling.v2beta1.ObjectMetricSource]; if you choose to ignore these errors, turn validation off with --validate=false
[...]
error: error validating "hello_world.yml": error validating data: [ValidationError(HorizontalPodAutoscaler.spec.metrics[2].object): unknown field "describedObject" in io.k8s.api.autoscaling.v2beta1.ObjectMetricSource, ValidationError(HorizontalPodAutoscaler.spec.metrics[2].object.target): unknown field "type" in io.k8s.api.autoscaling.v2beta1.CrossVersionObjectReference, ValidationError(HorizontalPodAutoscaler.spec.metrics[2].object.target): unknown field "value" in io.k8s.api.autoscaling.v2beta1.CrossVersionObjectReference, ValidationError(HorizontalPodAutoscaler.spec.metrics[2].object.target): missing required field "kind" in io.k8s.api.autoscaling.v2beta1.CrossVersionObjectReference, ValidationError(HorizontalPodAutoscaler.spec.metrics[2].object.target): missing required field "name" in io.k8s.api.autoscaling.v2beta1.CrossVersionObjectReference, ValidationError(HorizontalPodAutoscaler.spec.metrics[2].object): missing required field "targetValue" in io.k8s.api.autoscaling.v2beta1.ObjectMetricSource]; if you choose to ignore these errors, turn validation off with --validate=false

I'm running kubernetes 1.13.2

Proposed Solution: I had to change my config to this :

  - type: Object
    object:
      target:
        apiVersion: extensions/v1beta1
        kind: Ingress
        name: hello-world
      targetValue: 200
      metricName: requests-per-second

Page to Update: k8s.io/docs/tasks/run-application/horizontal-pod-autoscale-walkthrough/

Thanks

Skull0ne avatar Feb 21 '19 16:02 Skull0ne

Issues go stale after 90d of inactivity. Mark the issue as fresh with /remove-lifecycle stale. Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta. /lifecycle stale

fejta-bot avatar May 22 '19 17:05 fejta-bot

/kind bug /language en /remove-lifecycle stale

sftim avatar Jun 04 '19 09:06 sftim

Thanks for reporting this @Skull0ne

sftim avatar Jun 04 '19 09:06 sftim

How would that work now with averageValue I get following when i simply replace targetValue with averageValue error validating data: ValidationError(HorizontalPodAutoscaler.spec.metrics[0].object): missing required field "targetValue" in io.k8s.api.autoscaling.v2beta1.ObjectMetricSource;

reshadde avatar Jun 14 '19 16:06 reshadde

To be more precise, i want to achieve the following: https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale-walkthrough/#autoscaling-on-multiple-metrics-and-custom-metrics With Value, the target is compared directly to the returned metric from the API. With AverageValue, the value returned from the custom metrics API is divided by the number of pods before being compared to the target.

targetValue is mandatory so you have to specify both targetValue and averageValue (which has no effect) https://github.com/kubernetes/api/blob/master/autoscaling/v2beta1/types.go#L135 Definition in code is also not up to date with the doc's.

reshadde avatar Jun 14 '19 17:06 reshadde

https://github.com/zalando-incubator/kube-metrics-adapter#prometheus-collector

FYI: Replacing the prometheus-adapter and using hpa type "External" solved the issue for average value scaling.

reshadde avatar Jul 01 '19 07:07 reshadde

/priority backlog

sftim avatar Sep 10 '19 21:09 sftim

@Skull0ne The configuration mentioned in the doc is for api version autoscaling/v2beta2. You are probably trying to apply the configuration in an older version.

cueo avatar Oct 18 '19 13:10 cueo

Issues go stale after 90d of inactivity. Mark the issue as fresh with /remove-lifecycle stale. Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta. /lifecycle stale

fejta-bot avatar Jan 16 '20 14:01 fejta-bot

Stale issues rot after 30d of inactivity. Mark the issue as fresh with /remove-lifecycle rotten. Rotten issues close after an additional 30d of inactivity.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta. /lifecycle rotten

fejta-bot avatar Feb 15 '20 15:02 fejta-bot

Thank you @Skull0ne and @reshadde ...

As per @reshadde's comment, AverageValue does not seem to work correctly. on k8s 1.14 fwiw

naseemkullah avatar Feb 25 '20 19:02 naseemkullah

Rotten issues close after 30d of inactivity. Reopen the issue with /reopen. Mark the issue as fresh with /remove-lifecycle rotten.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta. /close

fejta-bot avatar Mar 26 '20 20:03 fejta-bot

@fejta-bot: Closing this issue.

In response to this:

Rotten issues close after 30d of inactivity. Reopen the issue with /reopen. Mark the issue as fresh with /remove-lifecycle rotten.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta. /close

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

k8s-ci-robot avatar Mar 26 '20 20:03 k8s-ci-robot