Forum Navigation
You need to log in to create posts and topics.

Access Resources in Kubernetes cluster ClusterIP -> NodePort

Problem

User working with Prometheus installed in kubernetes in a cluster environment cannot see the metrics / alerts /graphs / status management page.

Solution

Need to Change the type of the service from ClusterIP to NodePort in order to expose the service on the cluster IP

List all your Kubernetes services in monitoring namespace

kubectl get service -n monitoring

edit the service

kubectl edit service prom-operator-prom-prometheus -n monitoring

Under Spec section in the YAML structure change the value for

type: ClusterIP
to
type: NodePort

Example

spec:
clusterIP: 10.233.8.194
externalTrafficPolicy: Cluster
ports:
– name: web
nodePort: 31531
port: 9090
protocol: TCP
targetPort: 9090
selector:
app: prometheus
prometheus:prom-operator-prom-prometheus
sessionAffinity: None
type: NodePort
status:
loadBalancer: {}

Check the assigned nodePort value and in your browser type

http://<CLUSTER IP ADDRESS>:31531

All content available through this Web Site is provided on an “AS IS” and “AS AVAILABLE” basis, with all faults. Tracston LTD makes no warranty or representation with respect to the quality, accuracy, or availability of the Web Site or any of its content.