Skip to main content
How do you connect to a running Prometheus server and open its UI? This guide explains common methods to access Prometheus deployed inside a Kubernetes cluster, how to inspect the Service that exposes it, and a quick demo using kubectl port-forward for local access. We’ll cover:
  • Inspecting the Prometheus Service
  • Options to expose Prometheus externally (NodePort, LoadBalancer, Ingress)
  • Quick demo: port-forwarding for local access

Inspect the Prometheus Service

First, list services to find Prometheus:
Example output (filtered to Prometheus-related services):
Here, prometheus-kube-prometheus-prometheus is type: ClusterIP, meaning it’s only reachable from inside the cluster (pods and other cluster-local clients). To export the full Service manifest for inspection:
A relevant excerpt from that YAML:

Options to access Prometheus from outside the cluster

You have several ways to make Prometheus accessible externally:
  • Change the Service type:
    • NodePort — exposes the Service on a node port accessible on each node.
    • LoadBalancer — requests a cloud provider load balancer to route external traffic.
  • Create an Ingress that routes HTTP(S) to the Service.
  • Use kubectl port-forward for a short-lived local tunnel (great for demos and debugging).
Quick commands to change the Service type to NodePort: Patch the Service (one-liner):
Or edit the Service manifest interactively:
For production or multi-user access, prefer LoadBalancer (cloud) or an Ingress with authentication and TLS. NodePort is simple but less flexible for serving traffic securely at scale.

Quick demo — port-forward Prometheus to localhost

Port-forwarding is the fastest way to access the Prometheus UI from your laptop for verification or troubleshooting.
  1. Find a Prometheus pod using labels:
  1. Forward port 9090 from the Service or a specific pod to your local machine:
  • Forward the Service (recommended — will route to the pod backing the Service):
  • Or forward a specific Prometheus pod:
  1. Open the Prometheus UI in your browser:
http://localhost:9090 This creates a temporary tunnel from your local port 9090 into the cluster’s Prometheus server and is ideal for quick checks or running queries.
kubectl port-forward is temporary and only binds to your client machine. It is not a replacement for proper external access (NodePort/LoadBalancer/Ingress) in production.
A browser screenshot of the Prometheus monitoring UI showing a query input bar, Graph/Table tabs, and a blank result area that says "No data queried yet." The toolbar shows options like Enable autocomplete, an Execute button, and an "Add Panel" button.

Summary

  • A Service of type: ClusterIP is cluster-internal only.
  • For quick access use kubectl port-forward.
  • For sustained or production access prefer LoadBalancer or Ingress with TLS and authentication; NodePort is a simple alternative for non-production use.

Watch Video