Heapster : Unauthorised, grafana: unauthorised

576 Views Asked by At

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?

2

There are 2 best solutions below

1
On BEST ANSWER

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/

7
On

Well, your browser is not authorised to access kubernetes API. The simplest approach to this would be to run kubectl proxy that will authenticate to the cluster and proxy API requests from localhost to your kube API. That way you will be able to access API on 127.0.0.1 without credentials on the browser side.