Before we have talked about k8s network mode, be sure to practice
today we explain to monitor
specific yaml I have put Baidu network disk, we can use the direct download
link: https://pan.baidu.com/s / 16LLvtAM5EJaiy0AnmMTjjQ
extraction code: xw54
grafana This tool is a graphical interface, is responsible for presenting information, very powerful, can be combined prometheus, zabbix, collected temporarily, further comprising mysql, zk, etcd, nginx these data can be collected to show
prometheus is a timing database What is the timing of the database, that is, before the data storage, but you can not delete modify series of operations, eagerly prometheus the data is to fall into the memory and then periodically written to disk, this configuration file in prometheus definition, can modify,
further prometheus mainly taking the pull agent to the above data to the http protocol via pull mode
Further there is a push mode, which is mainly used for data collection of relatively short, mainly agent to Pushgateway for push operation, receiving, and prometheus to pull, pushgateway assembly of the above data, prometheus Further, the data collected by the alarm operation by AlertManager assembly, as defined herein will be more media alarms, text messages, micro-letters, nails are possible .
We are here to introduce the collection and will be shown later by the police micro enterprises letter
Deployed by:
image download required on all nodes in the cluster k8s
PROM pull Docker / node-exporter
Docker pull PROM / Prometheus: V2.0.0
Docker pull grafana / grafana: 4.2.0
resource information herein node-exporter physical machine to collect node node, traffic card, cpu. Memory, disk and other information
Because node-export is to collect information about the physical machines, each machine should have, you can use our previous DaemonSet controller, ensure that each machine there
Then start
after starting each machine can see if there are above
We have on each node
Prometheus deployment components
Here deployment requires rbac security certification, so you need to create a certification
next administration prometheus component in the form configmap profile
configmap: is to allow image and configuration files decoupling, in order to achieve a mirror portability and reusability, simple know on the line, will be introduced later to Kazakhstan
Now look at the building, will be used, and so will be back on this, this is a relatively important points
Next, create rbac and configmap
Way to create kubectl apply -f xxx.yaml format, fixed
Look
Prometheus the next start deploying assembly
storage emptyDir mode is used herein, may be used hostpath, or NFS, dynamic memory may pv
External access to the file creation svc
k8s among svc and pod are linked through lable, ingress label is, basically clusters of related tags, the more important Ha
Svc and create some prometheus
Access look at
these data are pull over
sum by (pod_name)( rate(container_cpu_usage_seconds_total{image!="", pod_name!=""}[1m] ) )
查询pod的语句
Prometheus the graphics bad here, but also tall enough, we need to open source grafana on display
Also in two parts, grafana deployment and svc
Next is svc
here does not specify a fixed port Ha
is randomly assigned
Of course, you can deploy a domain name, easy access, ingress before we can use
Creating these three yaml
Start to see results
If no domain can bind hosts
ADMIN; ADMIN account password
Configuration prometheus source
can be directly imported input template number 315 online, compare and save time, you can also import json template
Prometheus effect is not better than before to be good,
good to explain here, we can use my yaml be configured directly today, there are questions please private letter or comment