在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):kubernetes-monitoring/kubernetes-mixin开源软件地址(OpenSource Url):https://github.com/kubernetes-monitoring/kubernetes-mixin开源编程语言(OpenSource Language):Jsonnet 99.2%开源软件介绍(OpenSource Introduction):Prometheus Monitoring Mixin for Kubernetes
A set of Grafana dashboards and Prometheus alerts for Kubernetes. Releases
In Kubernetes 1.14 there was a major metrics overhaul implemented. Therefore v0.1.x of this repository is the last release to support Kubernetes 1.13 and previous version on a best effort basis. Some alerts now use Prometheus filters made available in Prometheus 2.11.0, which makes this version of Prometheus a dependency. Warning: This compatibility matrix was initially created based on experience, we do not guarantee the compatibility, it may be updated based on new learnings. Warning: By default the expressions will generate grafana 7.2+ compatible rules using the $__rate_interval variable for rate functions. If you need backward compatible rules please set grafana72: false in your _config How to useThis mixin is designed to be vendored into the repo with your infrastructure config. To do this, use jsonnet-bundler: You then have three options for deploying your dashboards
Generate config filesYou can manually generate the alerts, dashboards and rules files, but first you must install some tools:
Then, grab the mixin and its dependencies:
Finally, build the mixin:
The Dashboards for Windows NodesThere are separate dashboards for windows resources.
These dashboards are based on metrics populated by windows-exporter from each Windows node. Running the testsmake test Using with prometheus-ksonnetAlternatively you can also use the mixin with prometheus-ksonnet, a ksonnet module to deploy a fully-fledged Prometheus-based monitoring system for Kubernetes: Make sure you have the ksonnet v0.8.0:
In your config repo, if you don't have a ksonnet application, make a new one (will copy credentials from current context):
Grab the kubernetes-jsonnet module using and its dependencies, which include the kubernetes-mixin:
Assuming you want to run in the default namespace ('environment' in ksonnet parlance), add the follow to the file local prometheus = import "prometheus-ksonnet/prometheus-ksonnet.libsonnet";
prometheus {
_config+:: {
namespace: "default",
},
} Apply your config:
Using prometheus-operatorTODO Multi-cluster supportKubernetes-mixin can support dashboards across multiple clusters. You need either a multi-cluster Thanos installation with // Opt-in to multiCluster dashboards by overriding this and the clusterLabel.
showMultiCluster: true,
clusterLabel: '<your cluster label>', Customising the mixinKubernetes-mixin allows you to override the selectors used for various jobs, to match those used in your Prometheus set. You can also customize the dashboard names and add grafana tags. In a new directory, add a file local kubernetes = import "kubernetes-mixin/mixin.libsonnet";
kubernetes {
_config+:: {
kubeStateMetricsSelector: 'job="kube-state-metrics"',
cadvisorSelector: 'job="kubernetes-cadvisor"',
nodeExporterSelector: 'job="kubernetes-node-exporter"',
kubeletSelector: 'job="kubernetes-kubelet"',
grafanaK8s+:: {
dashboardNamePrefix: 'Mixin / ',
dashboardTags: ['kubernetes', 'infrastucture'],
},
},
} Then, install the kubernetes-mixin:
Generate the alerts, rules and dashboards:
Customising alert annotationsThe steps described below extend on the existing mixin library without modifying the original git repository. This is to make consuming updates to your extended alert definitions easier. These definitions can reside outside of this repository and added to your own custom location, where you can define your alert dependencies in your In your working directory, create a new file local utils = import 'lib/utils.libsonnet';
(import 'mixin.libsonnet') +
(
{
prometheusAlerts+::
// The specialAlerts can be in any other config file
local slack = 'observability';
local specialAlerts = {
KubePodCrashLooping: { slack_channel: slack },
KubePodNotReady: { slack_channel: slack },
};
local addExtraAnnotations(rule) = rule {
[if 'alert' in rule then 'annotations']+: {
dashboard: 'https://foo.bar.co',
[if rule.alert in specialAlerts then 'slack_channel']: specialAlerts[rule.alert].slack_channel,
},
};
utils.mapRuleGroups(addExtraAnnotations),
}
) Create new file: std.manifestYamlDoc((import '../kubernetes_mixin_override.libsonnet').prometheusAlerts) Running Same result can be achieved by modyfying the existing BackgroundAlert SeveritiesWhile the community has not yet fully agreed on alert severities and their to be used, this repository assumes the following paradigms when setting the severities:
Architecture and Technical Decisions
NoteYou can use the external tool call prom-metrics-check to validate the created dashboards. This tool allows you to check if the metrics installed and used in Grafana dashboards exist in the Prometheus instance. Please have a look at https://github.com/ContainerSolutions/prom-metrics-check. |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论