Kubernetes 对象名称 | 类型 | 请求资源 | 所属 Namespace |
node-annotator | Deployment | 每个实例 CPU:100m,Memory:100Mi ,共1个实例 | kube-system |
dynamic-scheduler | Deployment | 每个实例 CPU:400m,Memory:200Mi,共3个实例 | kube-system |
dynamic-scheduler | Service | - | kube-system |
node-annotator | ClusterRole | - | kube-system |
node-annotator | ClusterRoleBinding | - | kube-system |
node-annotator | ServiceAccount | - | kube-system |
dynamic-scheduler-policy | ConfigMap | - | kube-system |
restart-kube-scheduler | ConfigMap | - | kube-system |
probe-prometheus | ConfigMap | - | kube-system |
预选参数默认值 | 说明 |
5分钟平均 CPU 利用率阈值 | 节点过去5分钟平均 CPU 利用率超过设定阈值,不会调度 Pod 到该节点上。 |
1小时最大 CPU 利用率阈值 | 节点过去1小时最大 CPU 利用率超过设定阈值,不会调度 Pod 到该节点上。 |
5分钟平均内存利用率阈值 | 节点过去5分钟平均内存利用率超过设定阈值,不会调度 Pod 到该节点上。 |
1小时最大内存利用率阈值 | 节点过去1小时最大内存利用率超过设定阈值,不会调度 Pod 到该节点上。 |
优选参数默认值 | 说明 |
5分钟平均 CPU 利用率权重 | 该权重越大,过去5分钟节点平均 CPU 利用率对节点的评分影响越大。 |
1小时最大 CPU 利用率权重 | 该权重越大,过去1小时节点最大 CPU 利用率对节点的评分影响越大。 |
1天最大 CPU 利用率权重 | 该权重越大,过去1天内节点最大 CPU 利用率对节点的评分影响越大。 |
5分钟平均内存利用率权重 | 该权重越大,过去5分钟节点平均内存利用率对节点的评分影响越大。 |
1小时最大内存利用率权重 | 该权重越大,过去1小时节点最大内存利用率对节点的评分影响越大。 |
1天最大内存利用率权重 | 该权重越大,过去1天内节点最大内存利用率对节点的评分影响越大。 |
cpu_usage_avg_5m
、cpu_usage_max_avg_1h
、cpu_usage_max_avg_1d
、mem_usage_avg_5m
、mem_usage_max _avg_1h
、mem_usage_max_avg_1d
等指标,需要在 Prometheus 的 rules 规则进行如下配置:apiVersion: monitoring.coreos.com/v1kind: PrometheusRulemetadata:name: example-recordspec:groups:- name: cpu_mem_usage_activeinterval: 30srules:- record: cpu_usage_activeexpr: 100 - (avg by (instance) (irate(node_cpu_seconds_total{mode="idle"}[30s])) * 100)- record: mem_usage_activeexpr: 100*(1-node_memory_MemAvailable_bytes/node_memory_MemTotal_bytes)- name: cpu-usage-5minterval: 5mrules:- record: cpu_usage_max_avg_1hexpr: max_over_time(cpu_usage_avg_5m[1h])- record: cpu_usage_max_avg_1dexpr: max_over_time(cpu_usage_avg_5m[1d])- name: cpu-usage-1minterval: 1mrules:- record: cpu_usage_avg_5mexpr: avg_over_time(cpu_usage_active[5m])- name: mem-usage-5minterval: 5mrules:- record: mem_usage_max_avg_1hexpr: max_over_time(mem_usage_avg_5m[1h])- record: mem_usage_max_avg_1dexpr: max_over_time(mem_usage_avg_5m[1d])- name: mem-usage-1minterval: 1mrules:- record: mem_usage_avg_5mexpr: avg_over_time(mem_usage_active[5m])
global:evaluation_interval: 30sscrape_interval: 30sexternal_labels:rule_files:- /etc/prometheus/rules/*.yml # /etc/prometheus/rules/*.yml就是定义的rules文件
/etc/prometheus/rules/
目录下。apiVersion: monitoring.coreos.com/v1kind: PrometheusRulemetadata:name: example-recordspec:groups:- name: cpu_mem_usage_activeinterval: 30srules:- record: cpu_usage_activeexpr: 100 - (avg by (instance) (irate(node_cpu_seconds_total{mode="idle"}[30s])) * 100)- record: mem_usage_activeexpr: 100*(1-node_memory_MemAvailable_bytes/node_memory_MemTotal_bytes)- name: cpu-usage-5minterval: 5mrules:- record: cpu_usage_max_avg_1hexpr: max_over_time(cpu_usage_avg_5m[1h])- record: cpu_usage_max_avg_1dexpr: max_over_time(cpu_usage_avg_5m[1d])- name: cpu-usage-1minterval: 1mrules:- record: cpu_usage_avg_5mexpr: avg_over_time(cpu_usage_active[5m])- name: mem-usage-5minterval: 5mrules:- record: mem_usage_max_avg_1hexpr: max_over_time(mem_usage_avg_5m[1h])- record: mem_usage_max_avg_1dexpr: max_over_time(mem_usage_avg_5m[1d])- name: mem-usage-1minterval: 1mrules:- record: mem_usage_avg_5mexpr: avg_over_time(mem_usage_active[5m])
本页内容是否解决了您的问题?