Search code examples
kubernetesgrafanaunauthorizedheapster

Heapster : Unauthorised, grafana: unauthorised


I deployed heapster+grafana+influxdb combination. And i got the result like this

$kubectl cluster-info
Kubernetes master is running at https://192.168.99.100:8443
Heapster is running at 
https://192.168.99.100:8443/api/v1/namespaces/kube-
system/services/heapster/proxy
monitoring-grafana is running at 
https://192.168.99.100:8443/api/v1/namespaces/kube-
system/services/monitoring-grafana/proxy
monitoring-influxdb is running at 
https://192.168.99.100:8443/api/v1/namespaces/kube-
system/services/monitoring-influxdb/proxy

But when i tried to access these services in web browser i get the following error:

{
  "kind": "Status",
  "apiVersion": "v1",
  "metadata": {
  },
  "status": "Failure",
  "message": "Unauthorized",
  "reason": "Unauthorized",
  "code": 401
}

I don't understand why this is happening. Any help friends?


Solution

  • I solved the issue. I exposed both grafana and heapster using Nodeport. I added the following instruction under spec of grafana and heapster yaml files(services)

     type: NodePort
    

    Then I checked the services list by using the following command.

    kubectl get services -n kube-system
    

    It showed the expose port of grafana and heapster somthing like this.

    80:32068/TCP for heapster <br>
    80:32230/TCP for grafana<br>
    

    Then I could access both grafana and heapster with cluster_IP:port
    For ex:

    for grafana - http://192.168.99.100:32230/
    for heapster -http://192.168.99.100:32068/api/v1/model/namespaces/default/pods/