我正在使用 Rancher 1.5.1 在 AWS 上部署我的测试 Kubernetes 集群。
我先部署Rancher,确保hosts注册后没有错误。然后我使用 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.
我只能在这里看到的奇怪的事情是“端口:”条目是空的(而不是像我预期的那样具有某些值)。
这是 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
最后,我既无法通过 Rancher 负载均衡器映射到监控 Grafana 端口 80(我收到 503“未找到服务”错误)也无法通过 Kubernetes 端口转发(连接超时)连接到 Grafana 仪表板
我的集群信息输出:
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 仪表板?