Skip to main content
This guide explains how to access the Prometheus server running inside your Kubernetes cluster, including quick diagnostic commands and common access methods (temporary and production-ready). Follow the sequence below to inspect the service, confirm its configuration, and choose an access strategy.

Inspect the Prometheus services

Start by listing services in the cluster to find the Prometheus-related services and their types:
Note the TYPE column — in this example the Prometheus server is exposed via a ClusterIP service (prometheus-kube-prometheus-prometheus), which by default is accessible only from within the cluster.
If you are running commands in a specific namespace other than default, add -n <namespace> to the kubectl commands above. For example: kubectl get service -n monitoring.

Inspect the service YAML

Export the service YAML to confirm its configured ports, selectors, and type:
Example excerpt showing the key sections:
The type: ClusterIP confirms the service is internal-only.

How to connect to Prometheus (options)

Choose one of the following access methods depending on your needs. Summary below: Links and references:
Exposing Prometheus directly to the Internet can reveal sensitive metric data. When enabling external access, use authentication, TLS, and network restrictions (Ingress with auth, or firewall rules).

Quick demo — Port-forward to verify the UI

For a short demo or verification you can port-forward the service (or a pod) to your localhost. This does not change the cluster configuration and is temporary.
  1. List pods to find the Prometheus pod name (or use the service name for kubectl port-forward svc/...):
  1. Port-forward the Prometheus pod (or service) to localhost 9090:
  1. Open your browser at: http://localhost:9090
You should see the Prometheus web UI where you can run queries and explore time series data.
The image shows a Prometheus web interface for querying time series data, with options for enabling features like autocomplete and highlighting. It includes fields for expressions and no data has been queried yet.
This local port-forward is ideal for quick checks and demos. For persistent or multi-user access, choose NodePort, LoadBalancer, or an Ingress-based approach and secure it appropriately.

Example: change service type to NodePort (quick patch)

If you decide to expose Prometheus via NodePort briefly, you can patch the service:
After patching, run kubectl get svc prometheus-kube-prometheus-prometheus -o wide to see the assigned NODE-PORT. Then you can access Prometheus at http://<node-ip>:<node-port> (ensure firewall / security groups allow the port). For production setups, prefer Ingress with TLS and authentication, or use a cloud LoadBalancer combined with proper access controls.

Watch Video