如何使用Rancher 1.5.1安装干净的Kubernetes 1.5.0之后访问Heapster的Grafana仪表板

时间:2017-03-15 23:18:17

标签: kubernetes influxdb grafana rancher heapster

我正在使用Rancher 1.5.1在AWS上部署我的测试Kubernetes集群。

我首先部署Rancher并确保在主机注册后没有错误。 然后我使用Rancher目录中的“Kubernetes”条目安装Kubernetes。 这似乎没有任何错误成功,我可以访问我的1.5.0 Kubernetes:

kubectl version
Client Version: version.Info{Major:"1", Minor:"5", GitVersion:"v1.5.4", GitCommit:"7243c69eb523aa4377bce883e7c0dd76b84709a1", GitTreeState:"clean", BuildDate:"2017-03-08T02:50:34Z", GoVersion:"go1.8", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"5+", GitVersion:"v1.5.0-115+611cbb22703182", GitCommit:"611cbb22703182611863beda17bf9f3e90afa148", GitTreeState:"clean", BuildDate:"2017-01-13T18:03:00Z", GoVersion:"go1.7.4", Compiler:"gc", Platform:"linux/amd64"}

据我所知,带有InfluxDB和Grafana仪表板的Heapster现在是默认Kubernetes安装的一部分。所有Heapster,InfluxDB和Grafana相关的pod都没有显示日志和状态中的错误,并且似乎成功运行:

kubectl -n kube-system describe rs heapster-3467702493
Name:       heapster-3467702493
Namespace:  kube-system
Image(s):   gcr.io/google_containers/heapster:v1.2.0
Selector:   k8s-app=heapster,pod-template-hash=3467702493,version=v6
Labels:     k8s-app=heapster
        pod-template-hash=3467702493
        version=v6
Replicas:   1 current / 1 desired
Pods Status:    1 Running / 0 Waiting / 0 Succeeded / 0 Failed
No volumes.
No events.

kubectl -n kube-system get pods
NAME                                    READY     STATUS             RESTARTS   AGE
default-http-backend-w9td0              1/1       Running            0          1d
heapster-3467702493-b28jm               1/1       Running            0          1d
influxdb-grafana-876329878-5qpsd        2/2       Running            0          1d
kube-dns-1208858260-zb7d9               4/4       Running            0          1d
kubernetes-dashboard-2492700511-8g3bj   1/1       Running            0          1d


kubectl -n kube-system describe pod influxdb-grafana-876329878-5qpsd
Name:       influxdb-grafana-876329878-5qpsd
Namespace:  kube-system
Node:       euir1a-dclus11.qiotec-internal.com/10.11.4.172
Start Time: Tue, 14 Mar 2017 14:48:05 +0100
Labels:     name=influx-grafana
        pod-template-hash=876329878
Status:     Running
IP:     10.42.35.83
Controllers:    ReplicaSet/influxdb-grafana-876329878
Containers:
  influxdb:
    Container ID:   docker://49ad7e2033d9116cc98d1e7c8cd6e20c305179d68804b762bb19592fefa59b3e
    Image:      docker.io/kubernetes/heapster_influxdb:v0.5
    Image ID:       docker-pullable://kubernetes/heapster_influxdb@sha256:24de37030e0da01c39b8863231b70f359e1fe6d4449505da03e2e7543bb068cb
    Port:
    State:      Running
      Started:      Tue, 14 Mar 2017 14:48:29 +0100
    Ready:      True
    Restart Count:  0
    Volume Mounts:
      /data from influxdb-storage (rw)
      /var/run/secrets/kubernetes.io/serviceaccount from io-rancher-system-token-zgrrs (ro)
    Environment Variables:  <none>
  grafana:
    Container ID:   docker://bdb4e381f0cd05df0a2d1c7dffb52b3e6e724a27999e039c5399fef391fd6d32
    Image:      gcr.io/google_containers/heapster_grafana:v2.6.0-2
    Image ID:       docker-pullable://gcr.io/google_containers/heapster_grafana@sha256:208c98b77d4e18ad7759c0958bf87d467a3243bf75b76f1240a577002e9de277
    Port:
    State:      Running
      Started:      Tue, 14 Mar 2017 14:48:41 +0100
    Ready:      True
    Restart Count:  0
    Volume Mounts:
      /var from grafana-storage (rw)
      /var/run/secrets/kubernetes.io/serviceaccount from io-rancher-system-token-zgrrs (ro)
    Environment Variables:
      INFLUXDB_SERVICE_URL:     http://monitoring-influxdb.kube-system.svc.cluster.local:8086
      GF_AUTH_BASIC_ENABLED:        false
      GF_AUTH_ANONYMOUS_ENABLED:    true
      GF_AUTH_ANONYMOUS_ORG_ROLE:   Admin
      GF_SERVER_ROOT_URL:       /
Conditions:
  Type      Status
  Initialized   True
  Ready     True
  PodScheduled  True
Volumes:
  influxdb-storage:
    Type:   EmptyDir (a temporary directory that shares a pod's lifetime)
    Medium:
  grafana-storage:
    Type:   EmptyDir (a temporary directory that shares a pod's lifetime)
    Medium:
  io-rancher-system-token-zgrrs:
    Type:   Secret (a volume populated by a Secret)
    SecretName: io-rancher-system-token-zgrrs
QoS Class:  BestEffort
Tolerations:    <none>
No events.

我只能在这里看到的奇怪的事情是“Port:”条目是空的(而不是像我预期的那样有一些价值)。

以下是Influxdb-grafana-876329878-5qpsd日志的一部分。它似乎在端口3000上成功启动:

....
2017/03/14 13:48:42 [I] Migrator: exec migration id: create index UQE_dashboard_snapshot_delete_key - v5
2017/03/14 13:48:42 [I] Migrator: exec migration id: create index IDX_dashboard_snapshot_user_id - v5
2017/03/14 13:48:42 [I] Migrator: exec migration id: alter dashboard_snapshot to mediumtext v2
2017/03/14 13:48:42 [I] Migrator: exec migration id: create quota table v1
2017/03/14 13:48:42 [I] Migrator: exec migration id: create index UQE_quota_org_id_user_id_target - v1
2017/03/14 13:48:42 [I] Created default admin user: admin
2017/03/14 13:48:42 [I] Listen: http://0.0.0.0:3000
.Grafana is up and running.
Creating default influxdb datasource...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   272  100    37  100   235   2972  18877 --:--:-- --:--:-- --:--:-- 19583
HTTP/1.1 200 OK
Content-Type: application/json; charset=UTF-8
Set-Cookie: grafana_sess=3063bf504a9ec00a; Path=/; HttpOnly
Date: Tue, 14 Mar 2017 13:48:43 GMT
Content-Length: 37

{"id":1,"message":"Datasource added"}
Importing default dashboards...
...

服务也在增加:

kubectl -n kube-system get services
NAME                       CLUSTER-IP      EXTERNAL-IP   PORT(S)             AGE
default-http-backend       10.43.159.75    <none>        80/TCP              1d
heapster                   10.43.77.135    <none>        80/TCP              1d
kube-dns                   10.43.0.10      <none>        53/UDP,53/TCP       1d
kubernetes-dashboard       10.43.202.63    <none>        9090/TCP            1d
monitoring-grafana         10.43.186.82    <none>        80/TCP              1d
monitoring-influxdb        10.43.61.17     <none>        8086/TCP,8083/TCP   1d

最后,我无法连接到Grafana仪表板,也不能通过Rancher负载均衡器映射到monitoring-grafana端口80(我得到503“服务未找到”错误),也不能通过Kubernetes端口转发(连接超时)

我的群集信息输出:

kubectl cluster-info
Kubernetes master is running at https://my-rancher-host:8080/r/projects/1a5/kubernetes
KubeDNS is running at https://my-rancher-host:8080/r/projects/1a5/kubernetes/api/v1/proxy/namespaces/kube-system/services/kube-dns
kubernetes-dashboard is running at https://my-rancher-host:8080/r/projects/1a5/kubernetes/api/v1/proxy/namespaces/kube-system/services/kubernetes-dashboard

与此Heapster视频中演示的不同: https://www.youtube.com/watch?v=xSMNR2fcoLs

任何人都可以暗示可能出现的问题以及如何连接到Heapster的Grafana仪表板?

2 个答案:

答案 0 :(得分:2)

看来我必须在系统中添加正确的入口:

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: monitoring-ingress
  annotations:
    kubernetes.io/ingress.class: "nginx"
spec:
  rules:
  - host: monitoring.kube-system.mykubernetes.host
    http:
      paths:
      - path:
        backend:
          serviceName: monitoring-grafana
          servicePort: 80

答案 1 :(得分:0)

是的,几乎所有HTTP服务都应该有入口资源