1.下载并解压
wget https://github.com/kubernetes/heapster/archive/v1.5.4.tar.gz
tar -xzvf v1.5.4.tar.gz
mv v1.5.4.tar.gz heapster-1.5.4.tar.gz
2.修改配置
cd heapster-1.5.4/deploy/kube-config/influxdb
a.vim grafana.yaml 修改镜像镜像
< image: gcr.io/google_containers/heapster-grafana-amd64:v4.4.3
---
> image: wanghkkk/heapster-grafana-amd64-v4.4.3:v4.4.3
https://hub.docker.com/r/wanghkkk/heapster-grafana-amd64-v4.4.3/
取消注释
< # type: NodePort
---
> type: NodePort
b.vim heapster.yaml
< image: gcr.io/google_containers/heapster-amd64:v1.5.4
---
> image: fishchen/heapster-amd64:v1.5.4
https://hub.docker.com/r/fishchen/heapster-amd64/
< - --source=kubernetes:https://kubernetes.default
---
> - --source=kubernetes:https://kubernetes.default?kubeletHttps=true&kubeletPort=10250
c.vim influxdb.yaml
< image: gcr.io/google_containers/heapster-influxdb-amd64:v1.3.3
---
> image: fishchen/heapster-influxdb-amd64:v1.5.2
https://hub.docker.com/r/fishchen/heapster-influxdb-amd64/
3.执行文件
kubectl create -f .
4.执行heapster-rbac.yaml
cd …/rbac/
vim heapster-rbac.yaml 加入以下内容
---
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1beta1
metadata:
name: heapster-kubelet-api
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: system:kubelet-api-admin
subjects:
- kind: ServiceAccount
name: heapster
namespace: kube-system
执行
kubectl create -f heapster-rbac.yaml
5.检验
kubectl get pods -n kube-system | grep -E 'heapster|monitoring'
输出
heapster-77fd7449fd-5gszw 1/1 Running 0 44s
monitoring-grafana-cd886b7-q22zb 1/1 Running 0 45s
monitoring-influxdb-c6fbbcc55-r2v42 1/1 Running 0 45s
启动好可以看到cpu及内存使用率
6.访问grafana
kubectl get svc -n kube-system|grep -E 'monitoring|heapster'
输出
heapster ClusterIP 10.254.201.111 <none> 80/TCP 57s
monitoring-grafana NodePort 10.254.144.149 <none> 80:8440/TCP 57s
monitoring-influxdb ClusterIP 10.254.4.255 <none> 8086/TCP 57s
grafana端口为8440,访问地址
http://123.56.41.163:8440/?orgId=1