Grafana is not working on kubernetes cluster while using k8s Service

11/25/2018

I am trying to setup a very simple monitoring cluster for my k8s cluster. I have successfully created prometheus pod and is running fine. When I tried to create grafana pod the same way, its not accessible through the node port.

My Grafana deploy file is-

apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: grafana-deployment
  namespace: monitoring
spec:
  replicas: 1
  template:
    metadata:
      labels:
        app: grafana-server
    spec:
      containers:
        - name: grafana
          image: grafana/grafana:5.1.0
          ports:
            - containerPort: 3000

And Service File is --

apiVersion: v1
kind: Service
metadata:
  name: grafana-service
  namespace: monitoring
spec:
  selector:
    app: grafana-server
  type: NodePort
  ports:
    - port: 3000
      targetPort: 3000

Note- When I am creating a simple docker container on the same host using same image, its working fine.

-- vivek
grafana
kubernetes

1 Answer

12/3/2018

I have come to know that my servers provider had not enabled these ports (like grafana-3000, kibana-5601). Never thought of this since i am using these servers from quite a long time and never faced such blocker. They implemented these rules recently. Well, after some port approvals, I tried the same config again and it worked like a charm.

-- vivek
Source: StackOverflow