kubernetes autoscale 获取指标失败(heapster 已经安装在 kube-system 命名空间中)

kubernetes autoscale fails to get metrics (heapster already installed in kube-system namespace)

我用 vagrant 和 centos 7 创建了一个迷你集群。我设法安装了 kube-dns 和 heapster,但是当我尝试使用 php-apache 示例测试自动缩放时它不起作用。

failed to get CPU consumption and request: failed to unmarshall heapster response: invalid character 'E' looking for beginning of value

这很奇怪,因为我可以看到 grafana 的指标和限制。我的 kube-dns 和我的 heapster 在 kube-system 命名空间中,所以它应该可以工作。

我有 kubernetes 1.2,如果有人能提供帮助那就太棒了。

这里是 heapster 的日志:

[vagrant@localhost ~]$ kubectl logs --namespace=kube-system heapster-xzy31
I0625 11:08:50.041788       1 heapster.go:65] /heapster --source=kubernetes:http://192.168.50.130:8080?inClusterConfig=false&useServiceAccount=true&auth= --sink=influxdb:http://monitoring-influxdb:8086
I0625 11:08:50.042310       1 heapster.go:66] Heapster version 1.1.0
I0625 11:08:50.090679       1 configs.go:60] Using Kubernetes client with master "http://192.168.50.130:8080" and version v1
I0625 11:08:50.090705       1 configs.go:61] Using kubelet port 10255
E0625 11:09:00.097603       1 influxdb.go:209] issues while creating an InfluxDB sink: failed to ping InfluxDB server at "monitoring-influxdb:8086" - Get http://monitoring-influxdb:8086/ping: dial tcp: lookup monitoring-influxdb on 10.254.0.10:53: read udp 172.17.39.2:38757->10.254.0.10:53: read: connection refused, will retry on use
I0625 11:09:00.097624       1 influxdb.go:223] created influxdb sink with options: host:monitoring-influxdb:8086 user:root db:k8s
I0625 11:09:00.097638       1 heapster.go:92] Starting with InfluxDB Sink
I0625 11:09:00.097641       1 heapster.go:92] Starting with Metric Sink
I0625 11:09:00.103486       1 heapster.go:171] Starting heapster on port 8082
I0625 11:10:05.003399       1 manager.go:79] Scraping metrics start: 2016-06-25 11:09:00 +0000 UTC, end: 2016-06-25 11:10:00 +0000 UTC
E0625 11:10:05.003479       1 kubelet.go:279] Node 192.168.50.131 is not ready
I0625 11:10:05.051081       1 manager.go:152] ScrapeMetrics: time: 47.581507ms size: 70
I0625 11:10:05.060501       1 influxdb.go:201] Created database "k8s" on influxDB server at "monitoring-influxdb:8086"
I0625 11:11:05.001120       1 manager.go:79] Scraping metrics start: 2016-06-25 11:10:00 +0000 UTC, end: 2016-06-25 11:11:00 +0000 UTC
I0625 11:11:05.091844       1 manager.go:152] ScrapeMetrics: time: 90.657932ms size: 132

好的,我找到了解决方案,我的集群存在缺陷。我也必须在主人身上安装法兰绒。由于 vagrant.

使用选项 --iface=eth1

我遵循了这个指南http://severalnines.com/blog/installing-kubernetes-cluster-minions-centos7-manage-pods-services,但他们没有说要在 master 上安装 flannel。

现在一切正常。