Before you begin

Follow the Get started guide to install Gloo Gateway v2, set up a gateway resource, and deploy the httpbin sample app.

Set up Prometheus

  1. Deploy Prometheus in your cluster or configure your Prometheus instance to scrape metrics from the gateway pod. For example, if you use the Prometheus community Helm chart to install Prometheus, add the following configuration to your Helm values file.

      helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
    helm repo update
    
    helm upgrade --install kube-prometheus-stack \
    prometheus-community/kube-prometheus-stack \
    --version 30.0.1 \
    --namespace monitoring \
    --create-namespace \
    --values - <<EOF
    serverFiles:
      prometheus.yml:
        scrape_configs:
        - job_name: gateway-metrics
          scrape_interval: 15s
          scrape_timeout: 10s
          static_configs:
          - targets:
            - gloo-proxy-http.gloo-system:8080
    EOF
      
  2. Verify that the Prometheus components are up and running.

      kubectl get pods -n monitoring
      

    Example output:

      NAME                                                        READY   STATUS    RESTARTS   AGE
    alertmanager-kube-prometheus-stack-alertmanager-0           2/2     Running   0          60s
    kube-prometheus-stack-grafana-5ff66f6dd7-8ldll              3/3     Running   0          65s
    kube-prometheus-stack-kube-state-metrics-6c7f84c486-8rzc6   1/1     Running   0          64s
    kube-prometheus-stack-operator-79cb67969d-6wqdq             1/1     Running   0          64s
    kube-prometheus-stack-prometheus-node-exporter-4gpzj        1/1     Running   0          65s
    kube-prometheus-stack-prometheus-node-exporter-6xfh8        1/1     Running   0          65s
    kube-prometheus-stack-prometheus-node-exporter-74tqb        1/1     Running   0          65s
    kube-prometheus-stack-prometheus-node-exporter-9j9lv        1/1     Running   0          65s
    kube-prometheus-stack-prometheus-node-exporter-vsgdh        1/1     Running   0          65s
    kube-prometheus-stack-prometheus-node-exporter-zc9wk        1/1     Running   0          65s
    prometheus-kube-prometheus-stack-prometheus-0               2/2     Running   0          60s
      
  3. Port-forward the gateway deployment on port 19000.

      kubectl -n gloo-system port-forward deployment/gloo-proxy-http 19000
      
  4. Access the gateway metrics by reviewing the Prometheus statistics.