← Back to Blog

๐Ÿ“How to Discover Prometheus Endpoints Using DNS in OpenShift ๐Ÿš€

๐Ÿ“How to Discover Prometheus Endpoints Using DNS in OpenShift ๐Ÿš€ If you're running a project on OpenShift and want to integrate monitoring with Prometheus, a critical first step is locating your Prometheus endpoints.

๐Ÿ“How to Discover Prometheus Endpoints Using DNS in OpenShift ๐Ÿš€

If you're running a project on OpenShift and want to integrate monitoring with Prometheus, a critical first step is locating your Prometheus endpoints. Sometimes, especially in dynamic environments, youโ€™ll need to do this using DNS. Let's walk through the steps to find these endpoints effortlessly! ๐ŸŒ


๐Ÿš€ Step-by-Step Guide

  • ๐Ÿ’ก Start with the OpenShift Console
    Begin by accessing the OpenShift Web Console. This console is your main interface, and from here, you can manage all your resources, including Prometheus.

how to discover 1

  • ๐Ÿ” Check the Prometheus Operator
    Navigate to the namespace where your Prometheus Operator is installed. In many cases, this is openshift-monitoring or a custom namespace you defined during setup.

how to discover 2

  • โš™๏ธ Look for Service Discovery
    Within your Prometheus instance configuration, locate the ServiceMonitor and PodMonitor resources. These resources define which services and pods Prometheus will monitor, and typically, they include DNS entries.

  • Access these resources by running: oc get servicemonitor -n <namespace> oc get podmonitor -n <namespace>

  • ๐Ÿ“ Note: Replace <namespace> with your actual namespace.

๐Ÿ–ฅ๏ธ Screenshot Pause: Display a terminal showing oc get servicemonitor and oc get podmonitor commands.

  • ๐ŸŒ View DNS Entries in ServiceMonitor Config ***
    In each ServiceMonitor or PodMonitor definition, look for the DNS entry that specifies the target endpoint. These entries often look like:

  • endpoints:

    • target:
      dnsName: "prometheus..svc.cluster.local"

Multi loadbalancers

how to discover 3

  • ๐Ÿ“ก Verify Endpoint Availability
    Use the curl command from within the OpenShift cluster to test these endpoints. For example:

oc exec -it -- curl http://prometheus..svc.cluster.local:9090/metrics

  • Replace <pod-name> with the name of a pod that has network access to the Prometheus service.

๐Ÿ–ฅ๏ธ Screenshot Pause: Show a terminal with a successful curl response to the DNS endpoint.

  • ๐Ÿ”— Integrate DNS-Based Endpoints in Prometheus Config
    Now that you have the DNS entries, update your Prometheus configuration (if needed) to ensure these endpoints are part of your scrape config. Your Prometheus Operator should now handle these dynamically, keeping your configuration flexible and scalable.

๐ŸŽ‰ Wrap-Up

Using DNS entries to locate Prometheus endpoints in OpenShift helps maintain robust monitoring in a dynamic environment. With these steps, youโ€™ll be ready to keep an eye on all critical metrics and ensure seamless observability!


๐Ÿ”— Connect with me:


Happy monitoring! ๐Ÿ“Š

reference > https://access.redhat.com/webassets/avalon/d/Red_Hat_OpenShift_Service_on_AWS-4-Networking-en-US/images/b4b1d1d35869ccf8ab16c88a9c99ea7a/202_OpenShift_Ingress_0222_load_balancer.png


Imported from rifaterdemsahin.com ยท 2025