以容器的方式安装:heapster influxdb grafana 三个插件:
cd heapster/
vi heapster.yaml
vi influxdb.yaml
vi grafana.yaml
kubectl create -f .
kubectl get pods -n kube-system -o wide
查看pod建立在哪个节点上 然后到那个节点去拉取相应版本的包,并更名tag 为 k8s.gcr.io/xxx:v1xxx
下载
docker pull registry.cn-hangzhou.aliyuncs.com/google_containers/heapster-influxdb-amd64:v1.5.2
docker pull registry.cn-hangzhou.aliyuncs.com/google_containers/heapster-grafana-amd64:v5.0.4
docker pull registry.cn-hangzhou.aliyuncs.com/google_containers/heapster-amd64:v1.5.4
打tag
docker tag registry.cn-hangzhou.aliyuncs.com/google_containers/heapster-amd64:v1.5.4 k8s.gcr.io/heapster-amd64:v1.5.4
docker tag registry.cn-hangzhou.aliyuncs.com/google_containers/heapster-influxdb-amd64:v1.5.2 k8s.gcr.io/heapster-influxdb-amd64:v1.5.2
docker tag registry.cn-hangzhou.aliyuncs.com/google_containers/heapster-grafana-amd64:v5.0.4 k8s.gcr.io/heapster-grafana-amd64:v5.0.4
kubectl create -f .
或者:
kubectl create -f heapster.yaml
kubectl create -f influxdb.yaml
kubectl create -f grafana.yaml
查看报错日志:
kubectl logs -f heapster-7ff8d6bf9f-mq2vn -n kube-system
无监控pod负载权限,从原admin-account.yaml中拿取一段,如下:
修改处:
name: heapster-admin
name: heapster
vi heapster.yaml 加入ClousterRole 权限绑定
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: heapster
namespace: kube-system
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: heapster-admin
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: cluster-admin
subjects:
- kind: ServiceAccount
name: heapster
namespace: kube-system
kubectl delete -f heapster.yaml
kubectl create -f heapster.yaml
kubectl logs -f heapster-7ff8d6bf9f-lkj22 -n kube-system
kubectl get pods -n kube-system -o wide
dashboard 管理界面查看图形界面监控数据: