Service name and route name in grafana dashboard using prometheus plugin and ingress kind

Hi, i have kong in kubernetes as an ingress controller with prometheus and grafana. I would like to ask anyone: there is a way to choose the names of the routes and services that I see in the grafana dashboard? Thanks

Used dashboard : Kong (official) dashboard for Grafana | Grafana Labs

Sample ingress:

kind: Ingress
  name: kong-ingress-test-api
  namespace: test-one
  annotations: kong "https-only" http01 letsencrypt-prod "false" test-auth

    - hosts:
      secretName: kong-ingress-test-api-tls
    - host:
        - path: /v1/user (nice to have in dashboard: "v1-user" as route name)
            serviceName: api-test (nice to have in dashboard: "test" as service name)
            servicePort: 80

Do you mean you want to filter which are shown? I’m not particularly familiar with Grafana’s layout language, but it looks like you can change the queries as shown in Querying basics | Prometheus

For example, instead of the default query for all routes using route=~"^foo should display only routes whose names begin with foo. Querying basics | Prometheus lists other match operators.

Add ad hoc filters | Grafana Labs provides a means to add queries interactively, though I’m not sure how that interacts with the various panels (since the queries apply to the entire dashboard).

I don’t know Grafana well. This dashboard basically has two combo boxes at the top: services and routes … an example of what appears in the services box is “namespace-servicename.80”. While I would have liked it to be “servicename” only. For routes, the situation is similar. I’d like to have some custom names for every route. Probably as you said I have to check in grafana.

Ah, that’s a bit different. Those suffixes actually are part of the service and route names in Kong when they’re generated by the ingress controller, and they can’t be overridden.

The controller adds that extra information because it can’t necessarily translate a single K8S Service into a single Kong service or a single Ingress into a single Kong route. There are some design differences between the K8S and Kong resources it needs to account for:

  • A K8S Service can have multiple ports, whereas a Kong service can only have one. The controller splits the K8S Service into multiple Kong services, one per port, and indicates the port in the name, in the form namespace.serviceName.port
  • A K8S Ingress can specify a different Service+Port per rule (hostname+path combination), whereas a Kong route can only map to a single Kong service. The controller splits the Ingress into multiple routes, one for each Ingress rule. Those routes’ names indicate the (0-indexed) rule order by hostname and path, e.g. the second path for the third hostname in an Ingress’ rule set would get a name like namespace.ingressName.21.

Either type of K8S resource could potentially require only one Kong resource, but we keep the same name scheme regardless.

The namespace information and suffixes are necessary to avoid route/service name conflicts, so there’s no way to avoid that type of convention.

Now I get it. Thanks

© 2019 Kong Inc.    Terms  •  Privacy  •  FAQ