Inspect the Prometheus services
Start by listing services in the cluster to find the Prometheus-related services and their types: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, andtype:
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:
- Kubernetes Service types: https://kubernetes.io/docs/concepts/services-networking/service/
- kubectl port-forward: https://kubernetes.io/docs/tasks/access-application-cluster/port-forward-access-application-cluster/
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.- List pods to find the Prometheus pod name (or use the service name for
kubectl port-forward svc/...):
- Port-forward the Prometheus pod (or service) to localhost 9090:
- Open your browser at: http://localhost:9090

Example: change service type to NodePort (quick patch)
If you decide to expose Prometheus via NodePort briefly, you can patch the service: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.