Giter VIP home page Giter VIP logo

Comments (6)

CatherineF-dev avatar CatherineF-dev commented on August 16, 2024

Could you share your HPA configurations after removing sensitive information? cc @az-software-engineer

An example: https://stackoverflow.com/questions/78130483/horizontal-pod-autoscaler-with-stackdriver-custom-metric-in-gke-fails-with-inva

from k8s-stackdriver.

az-software-engineer avatar az-software-engineer commented on August 16, 2024

@CatherineF-dev - Please see below.

Custom Metric:

image

Custom Log-Based Metric:

image

Example Values:
minReplicas: 1
maxReplicas: 10
averageValue: 50
backend_target_name: xyz

** Is HPA able to scale off Custom Log-Based Metrics (logging.googleapis.com) VS. Custom Metrics (custom.googleapis.com)?

from k8s-stackdriver.

CatherineF-dev avatar CatherineF-dev commented on August 16, 2024

This is a working example https://stackoverflow.com/questions/78130483/horizontal-pod-autoscaler-with-stackdriver-custom-metric-in-gke-fails-with-inva.

Could you follow this to use loadbalacing.googleapis.com|https|request_count?

apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
  name: my-autoscale
  namespace: somenamespace
spec:
  maxReplicas: 3
  metrics:
  - pods:
      metric:
        name: prometheus.googleapis.com|jvm_memory_bytes_used|gauge
        selector:
           matchLabels:
             metric.labels.area: heap
      target:
        averageValue: 2G
        type: AverageValue
  type: Pods
  minReplicas: 1
  scaleTargetRef:
    apiVersion: apps/v1
    kind: Deployment
    name: my-java-app

from k8s-stackdriver.

az-software-engineer avatar az-software-engineer commented on August 16, 2024

Thank you for the example. We've attempted the provided but using logging.googleapis.com rather than Prometheus. GKE accepts the new config but HPA still remains "Unable to read all metrics". Maybe the example worked due to the Prometheus use case?
image

from k8s-stackdriver.

CatherineF-dev avatar CatherineF-dev commented on August 16, 2024

For logging.googleapis.com metrics, found a similar example here https://cloud.google.com/kubernetes-engine/docs/tutorials/autoscaling-metrics#pubsub_8

apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
  name: pubsub
spec:
  minReplicas: 1
  maxReplicas: 5
  metrics:
  - external:
      metric:
       name: pubsub.googleapis.com|subscription|num_undelivered_messages
       selector:
         matchLabels:
           resource.labels.subscription_id: echo-read
      target:
        type: AverageValue
        averageValue: 2
    type: External
  scaleTargetRef:
    apiVersion: apps/v1
    kind: Deployment
    name: pubsub

from k8s-stackdriver.

az-software-engineer avatar az-software-engineer commented on August 16, 2024

Unfortunately, that is not working either. In the example provided, you're referencing "pubsub.googleapis.com" which we have successfully configured and tested. However, we're trying to get "logging.googleapis.com" to work using a user-defined custom metric that captures log events.

apiVersion: autoscaling/v2beta2
kind: HorizontalPodAutoscaler
metadata:
name: abc-hpa
namespace: abc-frontend
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: abc-server-deployment
minReplicas: {{ .Values.abc.hpa.min_replicas }}
maxReplicas: {{ .Values.abc.hpa.max_replicas }}
metrics:

  • external:
    metric:
    name: logging.googleapis.com|user|UserDefinedCustomMetric
    target:
    type: AverageValue
    averageValue: {{ .Values.abc.hpa.averageValue }}
    type: External
    scaleTargetRef:
    apiVersion: apps/v1
    kind: Deployment
    name: abc-server-deployment

from k8s-stackdriver.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.