I installed Apisix (using the helm chart) as my api-gateway on my EKS cluster and configured the prometheus plugin as shown in the apisix documentation >> https://apisix.apache.org/docs/apisix/3.2/plugins/prometheus/. However, prometheus is showing my apisix target is down.
I configured the apisix servicemonitor and added prometheus plugin to the configmap - config.yaml as below (gateway is the namespace I installed apisix). I am able to see the get the metrics using local host from the apisix-gateway service but not from prometheus as the target is down. I also changed the plugin export ip from 127.0.0.1 to 0.0.0.0 but it didnt resolve it.
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: apisix-metrics
labels:
app: apisix
spec:
namespaceSelector:
matchNames:
- gateway
selector:
matchLabels:
helm.sh/chart: apisix-2.1.0
app.kubernetes.io/name: apisix
app.kubernetes.io/instance: apisix
app.kubernetes.io/version: "3.4.0"
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/service: apisix-gateway
endpoints:
- scheme: http
targetPort: prometheus
path: /apisix/prometheus/metrics
interval: 15s
---
plugins:
- prometheus
plugin_attr:
prometheus:
export_uri: /apisix/prometheus/metrics
metrics: apisix_
enable_export_server: true
export_addr:
ip: 0.0.0.0
port: 9091