Heapster is a container cluster monitoring and performance analysis tool that naturally supports kubernetes and CoreOS.
Kubernetes has a well-known surveillance agent-cadvisor. The cadvisor is run on each kubernetes node, and it collects monitoring data (cpu,memory,filesystem,network,uptime) for both native and container.
In the newer version, K8S has integrated the Cadvisor functionality into the Kubelet component. Each node can be accessed directly from the Web.
1. Image download
[Email protected]_master ~]# Docker Pull Ist0ne/heapster-grafana-amd64
[Email protected]_master ~]# Docker Pull Ist0ne/heapster-amd64
[Email protected]_master ~]# Docker Pull ist0ne/heapster-influxdb-amd64:v1.1.1
2, download Heapster, the latest version 1.3.0
wget https://github.com/kubernetes/heapster/archive/v1.3.0.tar.gz
Tar zxf v1.3.0.tar.gz
3. Enter the heapster-1.3.0/deploy/kube-config/influxdb/directory
[[Email protected]_master heapster-1.3.0]# Ls-latr deploy/kube-config/influxdb/
Total 24
-rw-rw-r--1 root root 477 Mar Influxdb-service.yaml
-rw-rw-r--1 root root 493 Mar Influxdb-deployment.yaml
-rw-rw-r--1 root root 453 Mar Heapster-service.yaml
-rw-rw-r--1 root root 521 Mar Heapster-deployment.yaml
-rw-rw-r--1 root root 695 Mar Grafana-service.yaml
-rw-rw-r--1 root root 1417 Mar Grafana-deployment.yaml
4. Modify the image corresponding to the configuration file:
Grafana-deployment.yaml
Apiversion:extensions/v1beta1kind:deploymentmetadata:name:monitoring-grafana Namespace:kube-systemspec:replicas : 1 template:metadata:labels:task:monitoring k8s-app:grafana spec:containers:- Name:grafana image:docker.io/ist0ne/heapster-grafana-amd64:latest Ports:-containerport:3000 Protocol:tcp volumemounts:-mountpath:/var name:grafana-storage env:-N Ame:influxdb_host Value:monitoring-influxdb-name:grafana_port value: "#" # the F Ollowing env variables is required to make Grafana accessible via # The Kubernetes api-server proxy. On production clusters, we recommend # Removing these env variables, Setup auth for Grafana, and expose the Grafa NA # service using a loadbalancer or a public IP. -Name:gf_auth_basic_enabled value: "False"-name:gf_auth_anonymous_enableD value: "True"-name:gf_auth_anonymous_org_role Value:admin-name:gf_server_root_url # If You ' re is only using the API Server proxy, set this value instead: # Value:/api/v1/proxy/namespaces/ Kube-system/services/monitoring-grafana/value:/volumes:-Name:grafana-storage emptydir: {}
Heapster-deployment.yaml
apiVersion: extensions/v1beta1kind: Deploymentmetadata: name: heapster namespace: kube-systemspec: replicas: 1 template: metadata: labels: task: monitoring k8s-app: heapster spec: containers: - name: heapster image: docker.io/ist0ne/heapster-amd64:latest imagePullPolicy: IfNotPresent command: - /heapster - --source=kubernetes:http://192.168.3.216:8080?inClusterConfig=false - --sink=influxdb:http://monitoring-influxdb:8086
Influxdb-deployment.yaml
apiVersion: extensions/v1beta1kind: Deploymentmetadata: name: monitoring-influxdb namespace: kube-systemspec: replicas: 1 template: metadata: labels: task: monitoring k8s-app: influxdb spec: containers: - name: influxdb image: docker.io/ist0ne/heapster-influxdb-amd64:v1.1.1 volumeMounts: - mountPath: /data name: influxdb-storage volumes: - name: influxdb-storage emptyDir: {}
Start the service
[Email protected]_master heapster-1.3.0]# kubectl create-f deploy/kube-config/influxdb/
Delete Service
[Email protected]_master heapster-1.3.0]# kubectl delete-f deploy/kube-config/influxdb/
View Pods
[[Email Protected]_master ~]# kubectl get pods--all-namespaces
NAMESPACE NAME READY STATUS RESTARTS AGEdefault busybox 1/1 Running 93 3dkube-system heapster-4127054459-wzppn 1/1 Running 0 3dkube-system kube-dns-2074712928-dxv2q 4/4 Running 4 3dkube-system kubernetes-dashboard-3665076642-9z0jc 1/1 Running 0 3dkube-system monitoring-grafana-597639858-tqpf2 1/1 Running 0 3dkube-system monitoring-influxdb-3575671003-9rpkh 1/1 Running 0 3dweb nginx-491251965-dp4xz 1/1 Running 2 4dweb nginx-491251965-rjhhp 1/1 Running 2 4d
Open Browser Http://192.168.3.216:8080/ui
Kubernetes Integrated Heapster Monitoring