anushiya-thevapalan
anushiya-thevapalan

Reputation: 591

How to get latency details of load balancer in stackdriver?

I have a simple spring boot application deployed on Kubernetes on GCP. I wish to custom auto-scale the application using latency threshold (response time). Stackdriver has a set of metrics for load balancer. Details of the metrics can be found in this link.

I have exposed my application to an external IP using the following command

kubectl expose deployment springboot-app-new --type=LoadBalancer --port 80 --target-port 9000

I used this API explorer to view the metrics. The response code is 200, but the response is empty. The metrics filter I used is metric.type = "loadbalancing.googleapis.com/https/backend_latencies"

Question

  1. Why am I not getting anything in the response? Am I making any mistake?
  2. I have already enabled Stackdriver API. Is there any other settings to be made to get the response?

Upvotes: 3

Views: 2530

Answers (1)

yyyyahir
yyyyahir

Reputation: 2322

As mentioned in the comments, the metric you're trying to use belongs to an HTTP(S) load balancer and the type LoadBalancer, when used in GKE, will deploy a Network Load Balancer instead.

The reason you're not able to find its metrics using the Stackdriver Monitoring page is that, the link shared in the comment corresponds to a TCP/SSL Proxy load balancer (layer 7) documentation instead of a Network Load Balancer (layer 4), which is the one that is already created in your cluster and for now, the Network Load Balancer won't show up using the Stackdriver Monitoring page.

However, a feature request has been created to have this functionality enabled in the Monitoring dashboard.

If you need to have this particular metric (loadbalancing.googleapis.com/https/backend_latencies), it might be best to expose your deployment using an Ingress instead of using the LoadBalancer type. This will automatically create an HTTP(S) load balancer with the monitoring enabled instead of the current Network Load Balancer.

Upvotes: 4

Related Questions