I’m using Kong Ingress Controller on EKS, and have a three instances as dev, test, sandbox in different namespaces. As I want to monitor Kong and services behind it, I deployed Prometheus and Grafana on EKS.
I followed exactly the same steps in the document below:
I’m also confused here after reading this document and the following issue.
As described in the document below, there are three way to access metrics from Kong. One for enterprise version, and other two via Admin API or custom nginx template.
However, in the issue below @hbagdi you mentioned that ’ You only need to scrape the port 9542 of Kong deployment to get Prometheus metrics.
You do not need to change any configuration in the nginx template for this purpose.’
Make sure the Prometheus installation you have supports scrapping pods based on the annotations.
One way to verify if Prometheus is actually scrapping the pods is by checking the “Targets” page in Prometheus UI, which lists all the pods that Prometheus is currently scrapping for data.
Yes I have all the pods listed in Prometheus UI Targets section.
Let me ask it another way. Do I have to configure custom nginx template if I want to use custom port such as (9542) as described in Prometheus plugins page above up?
Nope. The way you installed Kong, a ConfigMap is mounted into Kong’s container as a volume and there should be an KONG_NGINX_INCLUDE environment variable that takes care of the server that is listening on port 9542.
Let’s drill deeper.
What do you get if you make a HTTP GET /metrics request on port 9542 in Kong’s container?
is it the right way to define KongPlugin for multiple kong ingress controllers? defining kong-x class?
The thing is, I was able to monitor Kong while there is only one. After creating 3 instances per namespaces dev-test-sandbox and setting ingress classes explicitly with env name i.e kong-dev and adding kubernetes.io/ingress.class: “kong-dev” annotation to the KongPlugin , the dashboard stopped showing the results.
kong-dev-kong-545cd86985-6hqbd proxy error “/kong_prefix/html/index.html” is not found (2: No such file or directory), client: 127.0.0.1, server: kong_prometheus_exporter, request: “GET / HTTP/1.1”, host: “localhost:9542”
The post can be marked as solved. The problem was about indentation of the kubernetes.io/ingress.class: “kong-dev” annotation in the KongPlugin yaml. After fixing this in the yaml, prometheus has started to scrap metrics.
Using web admission hook might be a good idea.
Thank you for your efforts