博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
prometheus配置
阅读量:4957 次
发布时间:2019-06-11

本文共 2936 字,大约阅读时间需要 9 分钟。

prometheus配置 
参考:
在configmap.yaml中要注意的是在1.7以后,获取cadvsion监控pod等的信息时,用的是kubelet的4194端口,
注意以下这段:这是采集cadvision信息,必须是通过kubelet的4194端口,所以Kubelet必须监听着,4194部署了cadvsion来获取pod中容器信息
prometheus/prometheus
#cat configmap.yaml
 
# https://github.com/prometheus/prometheus/blob/master/documentation/examples/prometheus-kubernetes.yml#L37
      
- job_name: 
'kubernetes-nodes'
        
tls_config:
          
ca_file: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt
        
bearer_token_file: /var/run/secrets/kubernetes.io/serviceaccount/token
        
kubernetes_sd_configs:
          
- role: node
        
relabel_configs:
          
- source_labels: [__address__]
            
regex: 
'(.*):10250'
            
replacement: 
'${1}:10255'
            
target_label: __address__
      
- job_name: 
'kubernetes-cadvisor'
        
scheme: https
        
tls_config:
          
ca_file: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt
        
bearer_token_file: /var/run/secrets/kubernetes.io/serviceaccount/token
        
kubernetes_sd_configs:
          
- role: node
        
relabel_configs:
        
- action: labelmap
          
regex: __meta_kubernetes_node_label_(.+)
        
- target_label: __address__
          
replacement: kubernetes.default.svc.cluster.
local
:443
        
- source_labels: [__meta_kubernetes_node_name]
          
regex: (.+)
          
target_label: __metrics_path__
          
replacement: /api/v1/nodes/${1}:4194/proxy/metrics
 
参考:
(2)
参考
# metrics from service endpoints on /metrics over https via the master proxy
# set annotation (prometheus.io/scrape: true) to enable
# Example: kubectl annotate svc myservice prometheus.io/scrape=true
- job_name:
'kubernetes-service-endpoints'
kubernetes_sd_configs: - role: endpoints api_server: https://master_ip tls_config: insecure_skip_verify:
true
basic_auth: username: admin password: api_password scheme: https tls_config: insecure_skip_verify:
true
basic_auth: username: admin password: api_password relabel_configs: -
source
_labels: [__meta_kubernetes_service_annotation_prometheus_io_scrape] action: keep regex:
true
-
source
_labels: [__meta_kubernetes_pod_annotation_prometheus_io_port] action: replace regex: (\d+) target_label: __meta_kubernetes_pod_container_port_number -
source
_labels: [__meta_kubernetes_service_annotation_prometheus_io_path] action: replace regex: () target_label: __meta_kubernetes_service_annotation_prometheus_io_path replacement: /metrics -
source
_labels: [__meta_kubernetes_namespace, __meta_kubernetes_service_name, __meta_kubernetes_pod_container_port_number, __meta_kubernetes_service_annotation_prometheus_io_path] target_label: __metrics_path__ regex: (.+);(.+);(.+);(.+) replacement: /api/v1/namespaces/
$1
/services/
$2
:
$3
/proxy
$4
- target_label: __address__ replacement: master_ip:443 - action: labelmap regex: __meta_kubernetes_service_label_(.+) -
source
_labels: [__meta_kubernetes_namespace] action: replace target_label: kubernetes_namespace -
source
_labels: [__meta_kubernetes_service_name] action: replace target_label: kubernetes_name -
source
_labels: [__meta_kubernetes_pod_node_name] action: replace target_label: instance

转载于:https://www.cnblogs.com/skyzy/p/9236252.html

你可能感兴趣的文章
Sublime的Package Control的安装
查看>>
【HDOJ】2155 小黑的镇魂曲
查看>>
Mininet实验 脚本实现控制交换机行为
查看>>
c# 获取程序运行的根目录
查看>>
Java之匿名内部类详解
查看>>
adb 命令模拟按键事件
查看>>
Codeforces Round #436 D. Make a Permutation!
查看>>
scp的使用
查看>>
React组件绑定this的四种方式
查看>>
Jquery操作select
查看>>
利用Git将项目传到GitHub上
查看>>
转摘-谈谈后端业务系统的微服务化改造
查看>>
搜索引擎优化
查看>>
linux文件系统
查看>>
mysql以zip安装,解决the service already exists
查看>>
Maven-POM
查看>>
Java访问修饰符(访问控制符)
查看>>
替换空格_把字符串里面的空格替换成%20
查看>>
AFNetworking content type not support
查看>>
【MSDN】 SqlServer DBCC解析
查看>>