{"id":304072,"date":"2020-05-22T15:00:22","date_gmt":"2020-05-22T15:00:22","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=304072"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=304072","title":{"rendered":"\u041f\u0440\u043e\u0441\u0442\u043e\u0439 service discovery \u0432 Prometheus \u0447\u0435\u0440\u0435\u0437 Consul"},"content":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/company\/citymobil\/blog\/503246\/\">\n<blockquote><p>\u0417\u0430\u043a\u043e\u043d \u041f\u0430\u0440\u0435\u0442\u043e (\u043f\u0440\u0438\u043d\u0446\u0438\u043f \u041f\u0430\u0440\u0435\u0442\u043e, \u043f\u0440\u0438\u043d\u0446\u0438\u043f 80\/20) \u2014 \u00ab20 % \u0443\u0441\u0438\u043b\u0438\u0439 \u0434\u0430\u044e\u0442 80 % \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430, \u0430 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 80 % \u0443\u0441\u0438\u043b\u0438\u0439 \u2014 \u043b\u0438\u0448\u044c 20 % \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430\u00bb.<br \/>  <a href=\"https:\/\/ru.wikipedia.org\/wiki\/%D0%97%D0%B0%D0%BA%D0%BE%D0%BD_%D0%9F%D0%B0%D1%80%D0%B5%D1%82%D0%BE\">Wikipedia<\/a><\/p><\/blockquote>\n<p>\u041f\u0440\u0438\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e \u0442\u0435\u0431\u044f, \u0434\u043e\u0440\u043e\u0433\u043e\u0439 \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u044c!<\/p>\n<p>  <\/p>\n<p>\u041c\u043e\u044f \u043f\u0435\u0440\u0432\u0430\u044f \u0441\u0442\u0430\u0442\u044c\u044f \u043d\u0430 \u0425\u0430\u0431\u0440 \u043f\u043e\u0441\u0432\u044f\u0449\u0435\u043d\u0430 \u043f\u0440\u043e\u0441\u0442\u043e\u043c\u0443 \u0438, \u043d\u0430\u0434\u0435\u044e\u0441\u044c, \u043f\u043e\u043b\u0435\u0437\u043d\u043e\u043c\u0443 \u0440\u0435\u0448\u0435\u043d\u0438\u044e, \u0441\u0434\u0435\u043b\u0430\u0432\u0448\u0438\u043c \u0434\u043b\u044f \u043c\u0435\u043d\u044f \u0441\u0431\u043e\u0440 \u043c\u0435\u0442\u0440\u0438\u043a \u0432 Prometheus \u0441 \u0440\u0430\u0437\u043d\u043e\u0440\u043e\u0434\u043d\u044b\u0445 \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u0432 \u0443\u0434\u043e\u0431\u043d\u044b\u043c. \u042f \u0437\u0430\u0442\u0440\u043e\u043d\u0443 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0441\u0442\u0438, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043d\u043e\u0433\u0438\u0435 \u043c\u043e\u0433\u043b\u0438 \u043d\u0435 \u043f\u043e\u0433\u0440\u0443\u0436\u0430\u0442\u044c\u0441\u044f, \u044d\u043a\u0441\u043f\u043b\u0443\u0430\u0442\u0438\u0440\u0443\u044f Prometheus, \u0438 \u043f\u043e\u0434\u0435\u043b\u044e\u0441\u044c \u0441\u0432\u043e\u0438\u043c \u043f\u043e\u0434\u0445\u043e\u0434\u043e\u043c \u043f\u043e \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u0438 \u0432 \u043d\u0451\u043c \u043b\u0435\u0433\u043a\u043e\u0432\u0435\u0441\u043d\u043e\u0433\u043e service discovery.<br \/>  \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f: Prometheus, HashiCorp Consul, systemd, \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430 \u043d\u0430 Bash \u0438 \u043e\u0441\u043e\u0437\u043d\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u044f\u0449\u0435\u0433\u043e.<\/p>\n<p>  <\/p>\n<p>\u0415\u0441\u043b\u0438 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e \u0443\u0437\u043d\u0430\u0442\u044c, \u043a\u0430\u043a \u0432\u0441\u0435 \u044d\u0442\u043e \u0441\u0432\u044f\u0437\u0430\u043d\u043e \u0438 \u043a\u0430\u043a \u043e\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442, \u0434\u043e\u0431\u0440\u043e \u043f\u043e\u0436\u0430\u043b\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u0434 \u043a\u0430\u0442.<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/ne\/9h\/pe\/ne9hpett0pzkfg0cdv33q5o5rg0.png\" alt=\"Prometheus + Bash + Consul\"><\/p>\n<p><a name=\"habracut\"><\/a>  <\/p>\n<h2 id=\"vstrechayte-prometheus\">\u0412\u0441\u0442\u0440\u0435\u0447\u0430\u0439\u0442\u0435: Prometheus<\/h2>\n<p>  <\/p>\n<p>\u041c\u043e\u0435 \u0437\u043d\u0430\u043a\u043e\u043c\u0441\u0442\u0432\u043e \u0441 Prometheus \u043f\u0440\u043e\u0438\u0437\u043e\u0448\u043b\u043e, \u043a\u043e\u0433\u0434\u0430 \u0432\u043e\u0437\u043d\u0438\u043a\u043b\u0430 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c \u0441\u043e\u0431\u0438\u0440\u0430\u0442\u044c \u043c\u0435\u0442\u0440\u0438\u043a\u0438 \u0441 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430 <a href=\"https:\/\/kubernetes.io\">Kubernetes<\/a>. \u041f\u0440\u043e\u0431\u0435\u0436\u0430\u0432\u0448\u0438\u0441\u044c \u043f\u043e \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0430\u043c \u0432 \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442\u0435 \u0441\u0442\u0430\u043b\u043e \u043f\u043e\u043d\u044f\u0442\u043d\u043e, \u0447\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 Prometheus \u0438 \u0435\u0433\u043e pull-\u043c\u043e\u0434\u0435\u043b\u044c\u044e, \u043e\u0447\u0435\u043d\u044c \u0443\u0434\u043e\u0431\u043d\u043e, \u043a\u043e\u0433\u0434\u0430 \u043e\u043d \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e \u0443\u0437\u043d\u0430\u0451\u0442 \u043e \u0441\u0435\u0440\u0432\u0438\u0441\u0430\u0445, \u0441 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u043e\u0431\u0438\u0440\u0430\u0442\u044c \u043c\u0435\u0442\u0440\u0438\u043a\u0438. \u0414\u043b\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 Prometheus \u043f\u043e\u0434 Kubernetes \u0432 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u043c \u0444\u0430\u0439\u043b\u0435 <code>prometheus.yml<\/code> \u0435\u0441\u0442\u044c \u0434\u0438\u0440\u0435\u043a\u0442\u0438\u0432\u0430 <code>kubernetes_sd_configs<\/code>. \u041e\u043d\u0430 \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u0437\u0430 \u043a\u043e\u043c\u043c\u0443\u043d\u0438\u043a\u0430\u0446\u0438\u044e \u0441 kube-apiserver \u0441 \u0446\u0435\u043b\u044c\u044e \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f IP-\u0430\u0434\u0440\u0435\u0441\u043e\u0432 \u0438 \u043c\u0435\u0442\u0430\u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043e pod&#8217;\u0430\u0445 \u0432 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0435 \u0441 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043d\u0443\u0436\u043d\u043e \u0441\u043e\u0431\u0438\u0440\u0430\u0442\u044c \u043c\u0435\u0442\u0440\u0438\u043a\u0438.<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">scrape_configs: - job_name: kubernetes-pods   kubernetes_sd_configs:   - role: pod   bearer_token_file: \/var\/run\/secrets\/kubernetes.io\/serviceaccount\/token   tls_config:     insecure_skip_verify: true   relabel_configs:   - source_labels: [__meta_kubernetes_pod_annotation_prometheus_io_scrape]     action: keep     regex: true   - source_labels: [__meta_kubernetes_pod_ip, __meta_kubernetes_pod_annotation_prometheus_io_port]     action: replace     regex: (.+);(.+)     replacement: $1:$2     target_label: __address__   - source_labels: [__meta_kubernetes_pod_annotation_prometheus_io_path]     action: replace     regex: (.+)     target_label: __metrics_path__   - action: labelmap     regex: __meta_(kubernetes_namespace|kubernetes_pod_name|kubernetes_pod_label_manifest_sha1|kubernetes_pod_node_name)<\/code><\/pre>\n<p>  <\/p>\n<p><em>\u0421 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0432\u0437\u0433\u043b\u044f\u0434\u0430 \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0430 \u043d\u0435 \u0441\u0438\u043b\u044c\u043d\u043e \u043f\u043e\u043d\u044f\u0442\u043d\u0430\u044f, \u043d\u043e \u0441 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0435\u0439 \u0438 \u0432 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u043e\u0432 \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f \u043c\u043e\u0436\u043d\u043e. \u041f\u043e\u043c\u0438\u043c\u043e <code>role=pod<\/code> \u0435\u0441\u0442\u044c \u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u0440\u043e\u043b\u0438 \u0443 <code>kubernetes_sd_configs<\/code>.<\/em><\/p>\n<p>  <\/p>\n<p>\u041d\u0430\u0431\u043b\u044e\u0434\u0430\u044f, \u043a\u0430\u043a \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e Prometheus \u0443\u0437\u043d\u0430\u0435\u0442 \u043e \u0441\u0435\u0440\u0432\u0438\u0441\u0430\u0445 \u0432 Kubernetes, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043e <a href=\"https:\/\/kubernetes.io\/docs\/concepts\/workloads\/controllers\/daemonset\/\">DaemonSet<\/a> <a href=\"https:\/\/github.com\/prometheus\/node_exporter\">prometheus\/node_exporter<\/a>, \u0441\u0440\u0430\u0437\u0443 \u043f\u043e\u044f\u0432\u0438\u043b\u043e\u0441\u044c \u0436\u0435\u043b\u0430\u043d\u0438\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u044b\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u0434\u043b\u044f \u0441\u0431\u043e\u0440\u0430 \u043c\u0435\u0442\u0440\u0438\u043a \u0438 \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433\u0430 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e\u0441\u0442\u0438 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 \u0432\u043d\u0435 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430 Kubernetes: node_exporter, Zookeeper, Kafka, ClickHouse, CEPH, Elasticsearch, Tarantool &#8230;<\/p>\n<p>  <\/p>\n<p>\u041f\u0438\u0441\u0430\u0442\u044c \u043a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437 <code>targets<\/code> \u0432 <code>static_configs<\/code> \u043f\u0440\u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0438 \u043d\u043e\u0432\u043e\u0433\u043e \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0432 \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u043a\u043b\u0430\u0441\u0442\u0435\u0440 Kafka \u0438\u043b\u0438 OSD \u0432 CEPH \u043d\u0443 \u0441\u043e\u0432\u0441\u0435\u043c \u043d\u0435 \u043f\u0440\u043e \u0443\u0434\u043e\u0431\u043d\u043e\u0435 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0438\u043d\u0444\u0440\u0430\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u043e\u0439. \u0410 \u0435\u0449\u0435 \u044d\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u043d\u0435 \u0437\u0430\u0431\u044b\u0432\u0430\u0442\u044c \u0434\u0435\u043b\u0430\u0442\u044c. \u0414\u0430, \u043c\u043e\u0436\u043d\u043e \u0432\u0441\u0435 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0447\u0435\u0440\u0435\u0437 Ansible, \u043d\u043e \u0447\u0442\u043e \u0434\u0435\u043b\u0430\u0442\u044c, \u0435\u0441\u043b\u0438 \u043d\u0430 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u043e\u0442\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u043e\u0434\u0438\u043d CEPH OSD \u0434\u043b\u044f \u043e\u0431\u0441\u043b\u0443\u0436\u0438\u0432\u0430\u043d\u0438\u044f. \u0422\u043e\u0433\u0434\u0430 \u043d\u0443\u0436\u043d\u043e \u0435\u0449\u0435 \u0438 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0435 \u0432\u044b\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u044d\u0442\u043e\u0433\u043e \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u0438\u0437 \u043a\u043e\u043d\u0444\u0438\u0433\u0430 <code>prometheus.yml<\/code>. \u0412 \u0438\u0442\u043e\u0433\u0435 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u043e\u0433\u0440\u043e\u043c\u043d\u0430\u044f \u043a\u0443\u0447\u0430 \u0441\u043b\u043e\u0435\u0432 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0430\u0446\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0442\u043e\u0436\u0435 \u043d\u0443\u0436\u043d\u043e \u043d\u0435 \u0437\u0430\u0431\u044b\u0432\u0430\u0442\u044c \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c. \u0418\u043c\u0435\u043d\u043d\u043e \u0441\u043b\u043e\u0435\u0432, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043e\u0434\u043d\u0430 \u0442\u0430\u043a\u0430\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0430\u0446\u0438\u044f \u043f\u043e\u0440\u043e\u0436\u0434\u0430\u0435\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c \u0432 \u0434\u0440\u0443\u0433\u043e\u0439. \u0422\u0430\u043a \u0435\u0449\u0435 \u043a\u043e \u0432\u0441\u0435\u043c\u0443 \u044d\u0442\u043e\u043c\u0443 \u0441\u0438\u043b\u044c\u043d\u043e \u0440\u0430\u0437\u0440\u0430\u0441\u0442\u0430\u0435\u0442\u0441\u044f <code>prometheus.yml<\/code>, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043d\u0443\u0436\u043d\u043e \u043d\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u044f\u0442\u044c \u0441\u0435\u0440\u0432\u0438\u0441\u044b, \u0430 \u0435\u0449\u0435 \u0434\u0435\u043b\u0438\u0442\u044c \u0438\u0445 \u043d\u0430 \u0440\u0430\u0437\u043d\u044b\u0435 <code>job_name<\/code> \u0434\u043b\u044f \u0443\u0434\u043e\u0431\u043d\u043e\u0433\u043e \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u043c\u0435\u0442\u0440\u0438\u043a\u0430\u043c. \u0422\u0443\u0442 \u043b\u0435\u0433\u043a\u043e \u043f\u0440\u0438\u043a\u0438\u043d\u0443\u0442\u044c \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u0442\u0440\u043e\u043a \u0432 <code>prometheus.yml<\/code> \u043d\u0430\u043c \u0441\u043e\u0437\u0434\u0430\u0441\u0442 \u043e\u0434\u0438\u043d \u043a\u043b\u0430\u0441\u0442\u0435\u0440 Kafka \u0438\u0437 6 \u0431\u0440\u043e\u043a\u0435\u0440\u043e\u0432. \u0410 \u0435\u0441\u043b\u0438 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u043e\u0432 3. \u0418 \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u043a \u043d\u0438\u043c \u0435\u0449\u0435 3 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430 ClickHouse, \u0432 \u043a\u0430\u0436\u0434\u043e\u043c \u043f\u043e 4 \u043d\u043e\u0434\u044b. \u0410 \u0443\u0436 \u043f\u0440\u043e CEPH \u0438 \u0432\u043e\u043e\u0431\u0449\u0435 \u0433\u043e\u0432\u043e\u0440\u0438\u0442\u044c \u0441\u0442\u0440\u0430\u0448\u043d\u043e. \u0410 \u0435\u0449\u0435 \u043d\u0430 \u043a\u0430\u0436\u0434\u043e\u043c \u0441\u0435\u0440\u0432\u0435\u0440\u0435 \u043d\u0435 \u043f\u043e \u043e\u0434\u043d\u043e\u043c\u0443 \u0441\u0435\u0440\u0432\u0438\u0441\u0443, \u0441 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043d\u0443\u0436\u043d\u043e \u0441\u043e\u0431\u0438\u0440\u0430\u0442\u044c \u043c\u0435\u0442\u0440\u0438\u043a\u0438 \u2014 \u043f\u0440\u043e <a href=\"https:\/\/github.com\/prometheus\/node_exporter\">prometheus\/node_exporter<\/a> \u043d\u0435 \u043d\u0430\u0434\u043e \u0437\u0430\u0431\u044b\u0432\u0430\u0442\u044c. \u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u0432 \u0432\u0441\u044e \u0441\u0432\u043e\u044e \u0438\u043d\u0444\u0440\u0430\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0432 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0439 \u043c\u0435\u0440\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0438\u043a\u0438\u043d\u0443\u0442\u044c \u0438 \u0440\u0430\u0437\u043c\u0435\u0440 <code>prometheus.yml<\/code> \u043f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u0442\u043e\u043b\u044c\u043a\u043e <code>static_configs<\/code>.<\/p>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">Don\u2019t specify default values unnecessarily: simple, minimal configuration will make errors less likely.<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<p><u>Kubernetes Documentation, Configuration Best Practices, <a href=\"https:\/\/kubernetes.io\/docs\/concepts\/configuration\/overview\/#general-configuration-tips\">General Configuration Tips<\/a>.<\/u><\/p>\n<p>  <\/p>\n<p><em>\u0410\u0434\u043c\u0438\u043d\u044b \u043f\u043e\u0447\u0435\u043c\u0443-\u0442\u043e \u043e\u0447\u0435\u043d\u044c \u043b\u044e\u0431\u044f\u0442 \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0432 \u043a\u043e\u043d\u0444\u0438\u0433\u0430\u0445 \u0441\u0442\u0440\u043e\u043a\u0438 \u043f\u043e-\u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0432 \u0432\u0438\u0434\u0435 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0435\u0432, \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u044f \u0438\u0437 \u0444\u0430\u0439\u043b\u0430 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0443\u044e \u0441\u0432\u0430\u043b\u043a\u0443. \u041d\u0435 \u043d\u0443\u0436\u043d\u043e \u044d\u0442\u043e\u0433\u043e \u0434\u0435\u043b\u0430\u0442\u044c!<br \/>  \u0412 \u0444\u0430\u0439\u043b\u0435 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0432\u0430\u0436\u043d\u044b\u0435 \u0441\u0442\u0440\u043e\u043a\u0438, \u043e\u0442\u0432\u0435\u0447\u0430\u044e\u0449\u0438\u0435 \u0437\u0430 \u0440\u0430\u0431\u043e\u0442\u0443 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f. \u0424\u0430\u0439\u043b, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0448\u0435\u043b \u0432 \u0438\u043d\u0441\u0442\u0430\u043b\u043b\u044f\u0446\u0438\u043e\u043d\u043d\u043e\u043c \u043f\u0430\u043a\u0435\u0442\u0435, \u043c\u043e\u0436\u043d\u043e \u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0440\u044f\u0434\u043e\u043c, \u0434\u043e\u0431\u0430\u0432\u0438\u0432 \u0435\u043c\u0443 \u043f\u043e\u0441\u0442\u0444\u0438\u043a\u0441 <code>.default<\/code> \u0438\u043b\u0438 <code>.original<\/code>. \u0410 \u043c\u043e\u0436\u043d\u043e \u0432\u043e\u043e\u0431\u0449\u0435 \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0440\u044f\u0434\u043e\u043c \u0438 \u0432 \u0444\u0430\u0439\u043b \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438, \u0432 \u0448\u0430\u043f\u043a\u0435, \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u044c 2-3 \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u0435 \u0441\u0441\u044b\u043b\u043a\u0438 \u043d\u0430 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u044d\u0442\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430 \u0438\u043b\u0438 \u0435\u0433\u043e \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u043f\u043e-\u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0432\u043e \u0432\u043d\u0435\u0448\u043d\u0435\u043c \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0435: \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f, GitHub \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 \u043f\u0440\u043e\u0435\u043a\u0442\u0430. \u0421\u043e\u0432\u0441\u0435\u043c \u043d\u0435 \u0441\u043b\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0444\u0430\u0439\u043b \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u0443\u0434\u043e\u0431\u043d\u044b\u043c \u0438 \u0447\u0438\u0442\u0430\u0435\u043c\u044b\u043c \u0434\u043b\u044f \u043a\u043e\u043b\u043b\u0435\u0433 \u0438 \u0441\u0435\u0431\u044f \u0441\u0430\u043c\u043e\u0433\u043e, \u0432 \u0431\u0443\u0434\u0443\u0449\u0435\u043c.<\/em><\/p>\n<\/div><\/div>\n<p>  <\/p>\n<h2 id=\"vspomnim-pro-hashicorp-consul\">\u0412\u0441\u043f\u043e\u043c\u043d\u0438\u043c \u043f\u0440\u043e HashiCorp Consul<\/h2>\n<p>  <\/p>\n<p>\u041d\u0443\u0436\u043d\u0430 \u0431\u044b\u043b\u0430 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u0430\u044f \u0438 \u043f\u043e\u043d\u044f\u0442\u043d\u0430\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0430\u0446\u0438\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0441\u0435\u0440\u0432\u0438\u0441\u0430\u043c\u0438 \u0432 <code>prometheus.yml<\/code>. \u0421\u0430\u043c\u043e\u0435 \u0437\u043d\u0430\u043a\u043e\u043c\u043e\u0435 \u0447\u0442\u043e \u0441\u0440\u0430\u0437\u0443 \u0431\u0440\u043e\u0441\u0430\u043b\u043e\u0441\u044c \u0432 \u0433\u043b\u0430\u0437\u0430 \u0438\u0437 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 Prometheus \u2014 <code>consul_sd_configs<\/code>. \u0422\u043e \u0435\u0441\u0442\u044c, Prometheus, \u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u043e\u043c HashiCorp Consul, \u043c\u043e\u0436\u0435\u0442 \u0443\u0437\u043d\u0430\u0432\u0430\u0442\u044c \u043e \u0441\u0435\u0440\u0432\u0438\u0441\u0430\u0445 \u0441 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043d\u0443\u0436\u043d\u043e \u0441\u043e\u0431\u0438\u0440\u0430\u0442\u044c \u043c\u0435\u0442\u0440\u0438\u043a\u0438 \u0438 \u0437\u0430\u043e\u0434\u043d\u043e \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u0442\u044c \u0438\u0445 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e\u0441\u0442\u044c. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">scrape_configs: - job_name: SERVICE_NAME   consul_sd_configs:   - server: consul.example.com     scheme: https     tags: [test] # dev|test|stage|prod|...     services: [prometheus-SERVICE_NAME-exporter]<\/code><\/pre>\n<p>  <\/p>\n<p>\u0411\u0443\u0434\u0443\u0447\u0438 \u0443\u0436\u0435 \u0437\u043d\u0430\u043a\u043e\u043c\u044b\u043c \u0441 Consul, \u044f \u0437\u043d\u0430\u043b, \u0447\u0442\u043e \u0441\u0430\u043c \u043e\u043d \u043d\u0435 \u0443\u0437\u043d\u0430\u0435\u0442 \u043e \u0441\u0435\u0440\u0432\u0438\u0441\u0430\u0445 \u0434\u0430\u0436\u0435 \u043d\u0430 \u0442\u0435\u0445 \u043c\u0430\u0448\u0438\u043d\u0430\u0445, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0437\u0430\u043f\u0443\u0449\u0435\u043d \u0435\u0433\u043e agent. \u0427\u0435\u0440\u0435\u0437 \u0435\u0433\u043e <a href=\"https:\/\/www.consul.io\/api-docs\">\u043f\u0440\u043e\u0441\u0442\u043e\u0435 HTTP API<\/a> \u0441\u0435\u0440\u0432\u0438\u0441 \u043d\u0443\u0436\u043d\u043e \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432 Consul, \u0430 \u0435\u0449\u0435 \u0435\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0440\u0430\u0437\u0440\u0435\u0433\u0435\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c. \u0412\u0435\u0434\u044c \u0431\u044b\u0432\u0430\u0435\u0442, \u0447\u0442\u043e \u0441\u0435\u0440\u0432\u0438\u0441 \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0438\u043a\u043e\u043c\u0443 \u043d\u0435 \u043d\u0443\u0436\u0435\u043d: \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u043b\u0438, \u0438 \u043d\u0435 \u043f\u043e\u0434\u043e\u0448\u0435\u043b. \u0412 \u043f\u043e\u043b\u043d\u043e\u043c \u043e\u0431\u044a\u0435\u043c\u0435 \u044f \u043d\u0438\u043a\u043e\u0433\u0434\u0430 \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b Consul. \u0412\u043e\u0437\u043d\u0438\u043a\u0430\u043b\u0438 \u0442\u043e\u043b\u044c\u043a\u043e \u0437\u0430\u0434\u0430\u0447\u0438, \u0441 \u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 Consul \u043e\u0442\u043b\u0438\u0447\u043d\u043e \u0441\u043f\u0440\u0430\u0432\u043b\u044f\u043b\u0441\u044f \u0447\u0430\u0441\u0442\u044c\u044e \u0441\u0432\u043e\u0438\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439: KV-\u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435, HashiCorp Vault, \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u044f <a href=\"https:\/\/containo.us\/traefik\/\">Traefik<\/a>. \u0418, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043d\u0438\u043a\u043e\u0433\u0434\u0430 \u043d\u0435 \u043d\u0443\u0436\u0435\u043d \u0431\u044b\u043b \u0435\u0433\u043e DNS. \u0412\u043e\u0442 \u0438 \u0441\u0435\u0439\u0447\u0430\u0441 \u0437\u0430\u0434\u0430\u0447\u0430 \u0441\u0442\u043e\u044f\u043b\u0430 \u043d\u0435 \u0443\u0441\u043b\u043e\u0436\u043d\u0438\u0442\u044c \u0441\u0435\u0431\u0435 \u0436\u0438\u0437\u043d\u044c, \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u044f \u043d\u0430 \u043a\u0430\u0436\u0434\u043e\u043c \u0441\u0435\u0440\u0432\u0435\u0440\u0435 \u043f\u043e \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u043c \u0441\u0435\u0440\u0432\u0438\u0441\u0443 \u0432 \u0432\u0438\u0434\u0435 Consul agent. \u0414\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u043e\u0434\u0438\u043d \u0438\u043d\u0441\u0442\u0430\u043d\u0441 Consul, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0432 HTTP API \u0438 \u043a \u043d\u0435\u043c\u0443 \u0431\u0443\u0434\u0435\u0442 \u043e\u0431\u0440\u0430\u0449\u0430\u0442\u044c\u0441\u044f Prometheus \u0437\u0430 \u0441\u043f\u0438\u0441\u043a\u043e\u043c \u0430\u0434\u0440\u0435\u0441\u043e\u0432, \u043f\u043e \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u044b \u0442\u0435 \u0438\u043b\u0438 \u0438\u043d\u043e\u0435 \u0441\u0435\u0440\u0432\u0438\u0441\u044b. \u0418\u0434\u0435\u0430\u043b\u044c\u043d\u043e, \u0435\u0441\u043b\u0438 \u044d\u0442\u043e \u0432\u0441\u0435 \u0431\u0443\u0434\u0435\u0442 \u043f\u043e HTTPS, \u0445\u043e\u0442\u044f \u0441\u0435\u0442\u044c \u0438 \u0442\u0430\u043a \u0437\u0430\u043a\u0440\u044b\u0442\u0430\u044f.<\/p>\n<p>  <\/p>\n<p>\u041d\u0430 \u0442\u0430\u043a\u043e\u0439 \u0432\u043e\u043b\u043d\u0435 \u0441\u0442\u0430\u043b\u043e \u043f\u043e\u043d\u044f\u0442\u043d\u043e, \u0447\u0442\u043e \u0443\u0436\u0435 \u0438\u043c\u0435\u044e\u0449\u0438\u0439\u0441\u044f \u0432 Kubernetes <a href=\"https:\/\/kubernetes.io\/docs\/concepts\/workloads\/controllers\/statefulset\/\">StatefulSet<\/a> Consul, \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u044e\u0449\u0438\u0439 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u043d\u0443\u044e \u0440\u0430\u0431\u043e\u0442\u0443 Traefik, \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u043b\u044f service discovery \u0432 Prometheus. \u0418 \u0434\u0430\u0436\u0435 <a href=\"https:\/\/kubernetes.io\/docs\/concepts\/services-networking\/ingress\/\">Ingress<\/a> \u0432 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u0443\u044e \u0441\u0435\u0442\u044c \u0443 \u043d\u0435\u0433\u043e \u0443\u0436\u0435 \u0431\u044b\u043b, \u0442\u0430\u043a \u043a\u0430\u043a \u0431\u044b\u043b\u043e \u043f\u0430\u0440\u0443 \u043c\u043e\u043c\u0435\u043d\u0442\u043e\u0432 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f <a href=\"https:\/\/learn.hashicorp.com\/consul\/getting-started\/ui\">Consul\u2019s web UI<\/a>. \u0411\u043e\u043d\u0443\u0441\u043e\u043c Traefik \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u043b \u0435\u043c\u0443 HTTPS-\u0442\u0440\u0430\u043d\u0441\u043f\u043e\u0440\u0442 \u0441 \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u043c \u043e\u0442 Let`s Encrypt \u0447\u0435\u0440\u0435\u0437 DNS Challenge.<\/p>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">consul.yml<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"plaintext\"># https:\/\/consul.io\/docs\/agent\/options.html  --- apiVersion: v1 kind: Service metadata:   name: consul   labels:     app: consul spec:   selector:     app: consul   ports:   - name: http     port: 8500  --- apiVersion: apps\/v1 kind: StatefulSet metadata:   name: consul   labels:     app: consul spec:   serviceName: consul   selector:     matchLabels:       app: consul   volumeClaimTemplates:   - metadata:       name: data     spec:       storageClassName: cephfs       accessModes:       - ReadWriteOnce       resources:         requests:           storage: 1Gi   template:     metadata:       labels:         app: consul     spec:       automountServiceAccountToken: false       terminationGracePeriodSeconds: 60       containers:       - name: consul         image: consul:1.6         volumeMounts:         - name: data           mountPath: \/consul\/data         args:         - agent         - -server         - -client=0.0.0.0         - -bind=127.0.0.1         - -bootstrap         - -bootstrap-expect=1         - -disable-host-node-id         - -dns-port=0         - -ui         ports:         - name: http           containerPort: 8500         readinessProbe:           initialDelaySeconds: 10           httpGet:             port: http             path: \/v1\/agent\/members         livenessProbe:           initialDelaySeconds: 30           httpGet:             port: http             path: \/v1\/agent\/members         resources:           requests:             cpu: 0.2             memory: 256Mi  --- apiVersion: extensions\/v1beta1 kind: Ingress metadata:   name: consul   labels:     app: consul   annotations:     traefik.ingress.kubernetes.io\/frontend-entry-points: http,https     traefik.ingress.kubernetes.io\/redirect-entry-point: https spec:   rules:   - host: consul.example.com     http:       paths:       - backend:           serviceName: consul           servicePort: http<\/code><\/pre>\n<\/div><\/div>\n<p>  <\/p>\n<p>\u041d\u0430 \u044d\u0442\u043e\u043c \u044d\u0442\u0430\u043f\u0435 \u0443 \u043c\u0435\u043d\u044f \u0438\u043c\u0435\u043b\u0441\u044f Prometheus, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0433\u043e\u0442\u043e\u0432 \u0437\u0430\u0431\u0440\u0430\u0442\u044c \u0438\u0437 Consul \u0430\u0434\u0440\u0435\u0441\u0430 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 \u0438 \u043d\u0430\u0447\u0430\u0442\u044c \u0441\u043e\u0431\u0438\u0440\u0430\u0442\u044c \u0441 \u043d\u0438\u0445 \u043c\u0435\u0442\u0440\u0438\u043a\u0438, \u0438 \u0438\u043d\u0441\u0442\u0430\u043d\u0441 Consul, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043c\u043e\u0436\u043d\u043e \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0435\u0440\u0432\u0438\u0441\u044b. \u0412\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u0437\u0430\u0434\u0430\u0447\u0430 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0434\u0435\u0446\u0435\u043d\u0442\u0440\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u0443\u044e \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u044e \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u043d\u0430 \u043b\u044e\u0431\u043e\u043c \u0441\u0435\u0440\u0432\u0435\u0440\u0435 \u0438\u043d\u0444\u0440\u0430\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b. \u0418 \u043d\u0430 \u043f\u043e\u043c\u043e\u0449\u044c \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 Bash.<\/p>\n<p>  <\/p>\n<h2 id=\"vremya-dlya-bash-i-systemdservice\">\u0412\u0440\u0435\u043c\u044f \u0434\u043b\u044f Bash \u0438 systemd.service<\/h2>\n<p>  <\/p>\n<p>\u0412 \u0441\u0432\u043e\u0435\u0439 \u0438\u043d\u0444\u0440\u0430\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0435 \u044f \u0434\u0430\u0432\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e \u0438\u043c\u043c\u0443\u0442\u0430\u0431\u0435\u043b\u044c\u043d\u0443\u044e CoreOS Container Linux. \u0411\u044b\u043b\u043e \u0434\u0430\u0436\u0435 \u0434\u0435\u043b\u043e <a href=\"https:\/\/youtu.be\/G0E0T5bAPe0\">\u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u0442\u044c \u043e\u0431 \u044d\u0442\u043e\u0439 \u041e\u0421 \u043d\u0430 DevOpsConf Russia 2018<\/a>. \u042f \u0438 \u043f\u043e \u0441\u0435\u0439 \u0434\u0435\u043d\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e \u044d\u0442\u0443 \u041e\u0421 \u043a\u0430\u043a \u043e\u0441\u043d\u043e\u0432\u043d\u0443\u044e \u0434\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 \u0432 \u044d\u0444\u0435\u043c\u0435\u0440\u043d\u044b\u0445 Docker \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430\u0445, \u043e\u0431\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u044f \u0432 systemd.service. \u041d\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u0435\u043f\u0435\u0440\u044c \u044d\u0442\u043e <a href=\"https:\/\/flatcar-linux.org\/\">Flatcar Linux<\/a>, \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043f\u043e\u0434\u0445\u0432\u0430\u0442\u0438\u043b\u0438 \u0438\u0434\u0435\u044e \u0438 <a href=\"https:\/\/coreos.com\/os\/eol\/\">\u043d\u0435 \u0434\u0430\u043b\u0438 \u0435\u0439 \u043f\u043e\u0433\u0438\u0431\u043d\u0443\u0442\u044c<\/a>, \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432 \u043f\u043e\u043b\u043d\u0443\u044e \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c\u043e\u0441\u0442\u044c \u0441 CoreOS Container Linux. \u0410 \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u0441 CoreOS \u043d\u0430 Flatcar \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u044b\u043c \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435\u043c \u0441\u0438\u0441\u0442\u0435\u043c\u044b!<\/p>\n<p>  <\/p>\n<p>\u0412\u0441\u0435 \u0441\u0435\u0440\u0432\u0438\u0441\u044b \u043d\u0430 \u043c\u043e\u0451\u043c \u0441\u0435\u0440\u0432\u0435\u0440\u0435 \u2014 \u044d\u0442\u043e <a href=\"https:\/\/www.freedesktop.org\/software\/systemd\/man\/systemd.service.html\">systemd.service<\/a>. \u0410 <a href=\"https:\/\/www.freedesktop.org\/wiki\/Software\/systemd\/\">systemd<\/a> \u2014 \u044d\u0442\u043e \u043e\u0447\u0435\u043d\u044c \u043c\u043e\u0449\u043d\u044b\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0430\u043a\u0442\u0438\u0432\u043d\u043e \u0440\u0430\u0437\u0432\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0438 \u0440\u0435\u0448\u0430\u0435\u0442 \u043e\u0447\u0435\u043d\u044c \u043c\u043d\u043e\u0433\u043e \u0437\u0430\u0434\u0430\u0447 \u0432 Linux. \u0418 \u0435\u0441\u0442\u044c \u0432 systemd.service, \u0432 \u0441\u0435\u043a\u0446\u0438\u0438 <code>[Service]<\/code>, \u0442\u0430\u043a\u0438\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u043a\u0430\u043a <code>ExecStartPost<\/code>, <code>ExecStop<\/code>. \u041e\u043d\u0438-\u0442\u043e \u0438 \u043f\u043e\u043c\u043e\u0433\u0443\u0442 \u043c\u043d\u0435 \u0441 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0435\u0439 \u0438 \u0440\u0430\u0437\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0435\u0439 \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u0432 Consul.<br \/>  \u041e\u043f\u0438\u0448\u0443 \u0441\u0440\u0430\u0437\u0443 \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u044e\u043d\u0438\u0442\u0430 <code>prometheus-node-exporter.service<\/code>. \u042d\u0442\u043e\u0442 \u0441\u0435\u0440\u0432\u0438\u0441 \u043f\u0440\u0438\u043c\u0435\u0447\u0430\u0442\u0435\u043b\u0435\u043d \u0442\u0435\u043c, \u0447\u0442\u043e \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f \u0430\u0431\u0441\u043e\u043b\u044e\u0442\u043d\u043e \u043d\u0430 \u043a\u0430\u0436\u0434\u043e\u043c \u0441\u0435\u0440\u0432\u0435\u0440\u0435 \u0438 \u0435\u043c\u0443 \u043e\u0434\u043d\u043e\u043c\u0443 \u0432 <code>static_configs<\/code> \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0431\u044b \u0432\u044b\u0434\u0435\u043b\u0438\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0435 100 \u0441\u0442\u0440\u043e\u043a.<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">[Unit] After=docker.service [Service] Environment=CONSUL_URL=https:\/\/consul.example.com ExecStartPre=-\/usr\/bin\/docker rm --force %N ExecStart=\/usr\/bin\/docker run \\     --name=%N \\     --rm=true \\     --network=host \\     --pid=host \\     --volume=\/:\/rootfs:ro \\     --label=logger=json \\     --stop-timeout=30 \\     prom\/node-exporter:v0.18.1 \\     --log.format=logger:stdout?json=true \\     --log.level=error ExecStartPost=\/opt\/bin\/consul-service register -e prod -n %N -p 9100 -t prometheus,node-exporter ExecStop=\/opt\/bin\/consul-service deregister -e prod -n %N ExecStop=-\/usr\/bin\/docker stop %N Restart=always StartLimitInterval=0 RestartSec=10 KillMode=process [Install] WantedBy=multi-user.target<\/code><\/pre>\n<p>  <\/p>\n<p>\u041a\u0430\u043a \u0440\u0430\u0437 \u0432\u043e\u0442 \u0442\u0443\u0442 \u043f\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043d\u0435\u043a\u0438\u0439 <a href=\"https:\/\/github.com\/magna-z\/consul-service\">\/opt\/bin\/consul-service<\/a>. \u0423 \u043d\u0435\u0433\u043e \u0432\u0441\u0435\u0433\u043e \u043f\u0430\u0440\u0430 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u0433\u043e \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u0438 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u044f \u043e\u043f\u0438\u0448\u0443 \u043f\u043e\u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0439.<\/p>\n<p>  <\/p>\n<p>\u041f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f:<\/p>\n<p>  <\/p>\n<ul>\n<li><strong>CONSUL_URL<\/strong> \u2014 \u0430\u0434\u0440\u0435\u0441 Consul \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0431\u0443\u0434\u0443\u0442 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0441\u0435\u0440\u0432\u0438\u0441\u044b \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430.<\/li>\n<li><strong>CONSUL_TOKEN<\/strong> \u2014 \u043e\u043d \u0436\u0435 HTTP-\u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a \u00abX-Consul-Token\u00bb, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0438\u0439 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f \u0432 HTTP API Consul. \u0415\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432 Consul web UI, \u0430 \u0432 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0445 \u0432\u0435\u0440\u0441\u0438\u044f\u0445 \u043d\u0430 \u043d\u0435\u0433\u043e \u0435\u0449\u0435 \u043d\u0430\u0432\u0435\u0441\u0438\u043b\u0438 ACLs.<\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u041e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b:<\/p>\n<p>  <\/p>\n<ul>\n<li><strong>register\/deregister<\/strong> \u2014 \u0432\u0441\u0435\u0433\u0434\u0430 \u043f\u0435\u0440\u0432\u044b\u0439 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442. \u041e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u0437\u0430 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u044e \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u0438 \u0435\u0433\u043e \u0440\u0430\u0437\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u044e.<\/li>\n<li><strong>-e<\/strong> \u2014 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u0435 \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f \u0441\u0435\u0440\u0432\u0438\u0441 \u2014 [dev|test|prod|\u2026].<\/li>\n<li><strong>-n<\/strong> \u2014 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0441\u0435\u0440\u0432\u0438\u0441\u0430, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 prometheus-node-exporter. \u0412 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0432\u044b\u0448\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f <a href=\"https:\/\/www.freedesktop.org\/software\/systemd\/man\/systemd.unit.html#Specifiers\">\u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f %N<\/a>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0432 systemd.unit \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0438\u0437 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f \u0441\u0430\u043c\u043e\u0433\u043e \u044e\u043d\u0438\u0442\u0430.<\/li>\n<li><strong>-p<\/strong> \u2014 \u043f\u043e\u0440\u0442 \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0441\u0435\u0440\u0432\u0438\u0441 \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u0434\u0430\u0432\u0430\u0442\u044c \u0432 Prometheus \u043c\u0435\u0442\u0440\u0438\u043a\u0438. <em>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u0432 Consul.<\/em><\/li>\n<li><strong>-t<\/strong> \u2014 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u044b\u0435 \u0442\u0435\u0433\u0438 \u0447\u0435\u0440\u0435\u0437 \u0437\u0430\u043f\u044f\u0442\u0443\u044e. \u0421 \u0438\u0445 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043c\u043e\u0436\u043d\u043e \u0438\u043d\u0430\u0447\u0435 \u0444\u0438\u043b\u044c\u0442\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u044b\u0431\u043e\u0440\u043a\u0438 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 \u0432 Consul. <em>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u0432 Consul.<\/em><\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 consul-service \u0432 systemd.service \u043e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u043d\u044b\u043c \u0438 \u043f\u0440\u0435\u043f\u043e\u0434\u043d\u0435\u0441\u043b\u043e \u043e\u0434\u0438\u043d \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u0438\u044f\u0442\u043d\u044b\u0439 \u0431\u043e\u043d\u0443\u0441. systemd.service \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0441\u0442\u0430\u0440\u0442\u0430, \u0430 \u0438\u043c\u0435\u043d\u043d\u043e <code>ExecStartPost<\/code> \u0441 <code>consul-service register<\/code>, \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u0443\u0435\u0442 \u0441\u0435\u0440\u0432\u0438\u0441 \u0432 Consul, \u0438 Prometheus \u0441\u0440\u0430\u0437\u0443 \u0436\u0435 \u043c\u043e\u0436\u0435\u0442 \u0437\u0430\u0431\u0438\u0440\u0430\u0442\u044c \u0441 \u043d\u0435\u0433\u043e \u043c\u0435\u0442\u0440\u0438\u043a\u0438, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u0442\u044c \u0435\u0433\u043e \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e\u0441\u0442\u044c. \u041d\u043e \u0441\u0430\u043c\u043e\u0435 \u0443\u0434\u043e\u0431\u043d\u043e\u0435, \u043a\u043e\u0433\u0434\u0430 \u043d\u0443\u0436\u043d\u043e \u043d\u0435\u043d\u0430\u0434\u043e\u043b\u0433\u043e \u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0441\u0435\u0440\u0432\u0438\u0441 \u0438\u043b\u0438 \u043f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u0441\u0435\u0440\u0432\u0435\u0440. \u0412 \u044d\u0442\u043e\u0442 \u043c\u043e\u043c\u0435\u043d\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0442\u0441\u044f \u0432\u0441\u0435 <code>ExecStop<\/code>, \u0432 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435 <code>consul-service deregister<\/code>, \u0438 \u0441\u0435\u0440\u0432\u0438\u0441 \u0440\u0430\u0437\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u0443\u0435\u0442\u0441\u044f. Consul \u0438 \u0441\u043b\u0435\u0434\u043e\u043c Prometheus \u043e \u043d\u0435\u043c \u0437\u0430\u0431\u044b\u0432\u0430\u044e\u0442, \u0438 \u0442\u043e\u0433\u0434\u0430 \u043d\u0435\u0442 \u043d\u0438\u043a\u0430\u043a\u043e\u0433\u043e \u043b\u0438\u0448\u043d\u0435\u0433\u043e \u043e\u043f\u043e\u0432\u0435\u0449\u0435\u043d\u0438\u044f \u043e \u043d\u0435\u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e\u0441\u0442\u0438 \u043d\u0430\u043c\u0435\u0440\u0435\u043d\u043d\u043e \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u0441\u0435\u0440\u0432\u0438\u0441\u0430. \u041e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u044d\u0442\u043e \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u043d\u043e, \u043a\u043e\u0433\u0434\u0430 \u0440\u0430\u0431\u043e\u0442\u044b \u043f\u0440\u043e\u0432\u043e\u0434\u044f\u0442\u0441\u044f \u0432 \u043d\u043e\u0447\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u043e\u0434\u043d\u0438\u043c \u0438\u043d\u0436\u0435\u043d\u0435\u0440\u043e\u043c, \u0430 \u0434\u0440\u0443\u0433\u043e\u0439 \u0432 \u044d\u0442\u043e\u0442 \u043c\u043e\u043c\u0435\u043d\u0442 \u0432 \u043e\u0442\u0432\u0435\u0442\u0435 \u0437\u0430 Service Availability \u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u043f\u0443\u0433\u0430\u044e\u0449\u0438\u0435 \u0435\u0433\u043e \u043e\u043f\u043e\u0432\u0435\u0449\u0435\u043d\u0438\u044f \u043e \u043d\u0435\u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e\u0441\u0442\u0438 \u0441\u0435\u0440\u0432\u0438\u0441\u0430. \u041d\u043e \u0435\u0441\u043b\u0438 \u0441\u0435\u0440\u0432\u0438\u0441 \u0443\u043f\u0430\u043b, \u0438 \u043d\u0438\u043a\u0442\u043e \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e \u0434\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u0440\u0430\u0431\u043e\u0442 \u0435\u0433\u043e \u043d\u0435 \u043e\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u043b, \u0438 \u0440\u0430\u0437\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u043d\u0435 \u0431\u044b\u043b\u043e, \u0442\u043e \u043e\u043d \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u0434 \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433\u043e\u043c \u0441\u043e \u0432\u0441\u0435\u043c\u0438 \u0432\u044b\u0442\u0435\u043a\u0430\u044e\u0449\u0438\u043c\u0438.<\/p>\n<p>  <\/p>\n<p><u>\u041e\u0447\u0435\u043d\u044c \u0432\u0430\u0436\u043d\u044b\u043c \u043c\u043e\u043c\u0435\u043d\u0442\u043e\u043c \u0432 \u0440\u0430\u0431\u043e\u0442\u0435 consul-service \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u0435 <code>hostname<\/code> \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0438 <code>search<\/code> (\u0434\u043e\u043c\u0435\u043d\u044b \u043f\u043e\u0438\u0441\u043a\u0430) \u0432 <code>resolv.conf<\/code>. \u042d\u0442\u043e\u0442 \u0436\u0435 \u0430\u0434\u0440\u0435\u0441 \u0434\u043e\u043b\u0436\u0435\u043d \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0432 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u043c DNS-\u0441\u0435\u0440\u0432\u0435\u0440\u0435, \u0447\u0442\u043e \u043a\u0430\u043a \u043c\u0438\u043d\u0438\u043c\u0443\u043c best practice \u043f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 \u0441\u0435\u0440\u0432\u0435\u0440\u0430\u043c\u0438 \u0432 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0439 \u0441\u0440\u0435\u0434\u0435.<\/u><\/p>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u041e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u0441\u044c \u043a \u0441\u0432\u043e\u0438\u043c \u0441\u0435\u0440\u0432\u0435\u0440\u0430\u043c \u0442\u0430\u043a, \u043a\u0430\u043a \u0445\u043e\u0442\u0438\u0442\u0435, \u0447\u0442\u043e\u0431\u044b \u043e\u0442\u043d\u043e\u0441\u0438\u043b\u0438\u0441\u044c \u043a \u0432\u0430\u043c!<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<p><em>\u0415\u0441\u043b\u0438 \u0432\u044b \u0434\u043e \u0441\u0438\u0445 \u043f\u043e\u0440 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442\u0435 \u0441\u043e \u0441\u0432\u043e\u0438\u043c\u0438 \u0441\u0435\u0440\u0432\u0435\u0440\u0430\u043c\u0438 \u0432 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0439 \u0441\u0435\u0442\u0438 \u043f\u043e IP, \u0442\u043e \u0441\u0430\u043c\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u043f\u0440\u0438\u0441\u0432\u043e\u0438\u0442\u044c \u0441\u0435\u0431\u0435 \u0442\u043e\u0436\u0435 \u043a\u0430\u043a\u043e\u0439-\u043d\u0438\u0431\u0443\u0434\u044c \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u0438 \u043e\u0431\u044f\u0437\u0430\u0442\u044c \u043a\u043e\u043b\u043b\u0435\u0433 \u043e\u0431\u0440\u0430\u0449\u0430\u0442\u044c\u0441\u044f \u043a \u0432\u0430\u043c \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e \u043d\u0435\u043c\u0443. \u0418 \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0438 \u043d\u0430 \u043a\u0430\u043a\u0438\u0435 \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u044f \u043d\u0435 \u0440\u0435\u0430\u0433\u0438\u0440\u043e\u0432\u0430\u0442\u044c. \u0422\u0430\u043a \u0431\u0443\u0434\u0435\u0442 \u0441\u043f\u0440\u0430\u0432\u0435\u0434\u043b\u0438\u0432\u043e \u0438 \u0431\u044b\u0441\u0442\u0440\u043e \u043e\u0441\u043e\u0437\u043d\u0430\u0435\u0442\u0441\u044f \u0446\u0435\u043d\u043d\u043e\u0441\u0442\u044c \u0438\u043c\u0435\u043d\u0438.<\/em><\/p>\n<\/div><\/div>\n<p>  <\/p>\n<p><a href=\"https:\/\/github.com\/magna-z\/consul-service\">consul-service<\/a> \u043d\u0430\u043f\u0438\u0441\u0430\u043d \u043d\u0430 \u0447\u0438\u0441\u0442\u043e\u043c Bash \u0432 ~60 \u0441\u0442\u0440\u043e\u0447\u0435\u043a. \u0412 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044f\u0445 \u0443 \u043d\u0435\u0433\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u0445\u043e\u0440\u043e\u0448\u043e \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u0439 \u0432\u0441\u0435\u043c <a href=\"https:\/\/github.com\/curl\/curl\">cURL<\/a> \u0438 Bash. \u0423\u0432\u0435\u0440\u0435\u043d, \u0447\u0442\u043e \u0430\u0434\u043c\u0438\u043d \u0431\u0435\u0437 \u043e\u043f\u044b\u0442\u0430 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0431\u0435\u0433\u043b\u043e \u0440\u0430\u0437\u0431\u0435\u0440\u0435\u0442\u0441\u044f \u0432 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0441\u0442\u0440\u043e\u0447\u043a\u0430\u0445 \u044d\u0442\u043e\u0433\u043e \u0441\u043a\u0440\u0438\u043f\u0442\u0430. \u041b\u0438\u0446\u0435\u043d\u0437\u0438\u044f \u044d\u0442\u043e\u0433\u043e \u043c\u0430\u043a\u0440\u043e-\u0440\u0435\u0448\u0435\u043d\u0438\u044f <a href=\"https:\/\/github.com\/magna-z\/consul-service\/blob\/master\/LICENSE\">MIT<\/a>, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0435\u0441\u043b\u0438 \u043f\u043e\u044f\u0432\u0438\u0442\u0441\u044f \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c \u0434\u043e\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0435\u0433\u043e \u043f\u043e\u0434 \u0441\u0432\u043e\u0438 \u043d\u0443\u0436\u0434\u044b, \u043d\u0435 \u0441\u0442\u0435\u0441\u043d\u044f\u0439\u0442\u0435\u0441\u044c.<\/p>\n<p>  <\/p>\n<p>\u0422\u043e\u0442 \u0441\u0430\u043c\u044b\u0439 <code>scrape_configs<\/code> \u0432 <code>prometheus.yml<\/code> \u0434\u043b\u044f <a href=\"https:\/\/github.com\/prometheus\/node_exporter\">prometheus\/node_exporter<\/a>, \u0437\u0430\u043f\u0443\u0449\u0435\u043d\u043d\u043e\u043c \u043d\u0430 \u0432\u0441\u0435\u0445 \u0441\u0435\u0440\u0432\u0435\u0440\u0430\u0445, \u043b\u0430\u043a\u043e\u043d\u0438\u0447\u0435\u043d \u0438 \u043d\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043d\u0438\u043a\u0430\u043a \u043e\u0442 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u0432.<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">scrape_configs: - job_name: node-exporter   consul_sd_configs:   - server: consul.example.com     scheme: https     tags: [prod]     services: [prometheus-node-exporter]<\/code><\/pre>\n<p>  <\/p>\n<p><em><code>tags: [prod]<\/code> \u0442\u0443\u0442 \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u0437\u0430 \u0432\u044b\u0431\u043e\u0440\u043a\u0443 \u0438\u043d\u0441\u0442\u0430\u043d\u0441\u043e\u0432 \u0442\u043e\u043b\u044c\u043a\u043e production \u0441\u0440\u0435\u0434\u044b. \u042d\u0442\u043e \u043a\u0430\u043a \u0440\u0430\u0437 \u0442\u043e\u0442 \u0441\u0430\u043c\u044b\u0439 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 <code>-e<\/code> \u0432 <a href=\"https:\/\/github.com\/magna-z\/consul-service\">consul-service<\/a>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e \u0444\u0430\u043a\u0442\u0443 \u043f\u0440\u0435\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u0432 \u043e\u0434\u0438\u043d \u0438\u0437 \u0442\u0435\u0433\u043e\u0432 \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u043f\u0440\u0438 \u043f\u043e\u043f\u0430\u0434\u0430\u043d\u0438\u0438 \u0432 Consul.<\/em><\/p>\n<p>  <\/p>\n<p>\u041d\u0430 \u043c\u043e\u0438 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0441 Flatcar Linux \u0434\u043e\u0441\u0442\u0430\u0432\u043a\u0430 \u0441\u043a\u0440\u0438\u043f\u0442\u0430 \u0432 <code>\/opt\/bin<\/code> \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u043e\u043c <a href=\"https:\/\/www.ansible.com\/\">Ansible<\/a>. Playbook \u0432\u0441\u0435\u0433\u043e \u043d\u0430 \u043f\u0430\u0440\u0443 <code>tasks<\/code>. \u041d\u043e \u044d\u0442\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442\u0441\u044f \u0438 \u043b\u044e\u0431\u044b\u043c \u0434\u0440\u0443\u0433\u0438\u043c \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u043c, \u0445\u043e\u0442\u044c \u0441\u0442\u0440\u043e\u0447\u043a\u043e\u0439 \u0432 <code>crontab<\/code>.<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">tasks: - name: Create directory &quot;\/opt\/bin&quot;   with_items: [\/opt\/bin]   file:     state: directory     path: &quot;{{ item }}&quot;     owner: root     group: root     mode: 0755 - name: Download &quot;consul-service.sh&quot; to &quot;\/opt\/bin\/consul-service&quot;   get_url:     url: https:\/\/raw.githubusercontent.com\/devinotelecom\/consul-service\/master\/consul-service.sh     dest: \/opt\/bin\/consul-service     owner: root     group: root     mode: 0755     force: yes<\/code><\/pre>\n<p>  <\/p>\n<p><em>\u041e \u0442\u043e\u043c \u043a\u0430\u043a Ansible, \u0430 \u0442\u043e\u0447\u043d\u0435\u0435 Python, \u043f\u043e\u043f\u0430\u0434\u0430\u0435\u0442 \u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0430\u0445 Flatcar Linux \u0434\u0443\u043c\u0430\u044e, \u043c\u043e\u0436\u043d\u043e \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u0442\u044c \u0432 \u0431\u0443\u0434\u0443\u0449\u0438\u0445 \u0441\u0442\u0430\u0442\u044c\u044f\u0445. \u0412 \u043f\u043b\u0430\u043d\u0430\u0445 \u043f\u043e\u0441\u0432\u044f\u0442\u0438\u0442\u044c \u0446\u0435\u043b\u044b\u0439 \u0446\u0438\u043a\u043b \u0441\u0442\u0430\u0442\u0435\u0439 \u043f\u0440\u043e \u0438\u043c\u043c\u0443\u0442\u0430\u0431\u0435\u043b\u044c\u043d\u0443\u044e \u041e\u0421 <a href=\"https:\/\/flatcar-linux.org\/\">Flatcar Linux<\/a>.<\/em><\/p>\n<p>  <\/p>\n<h2 id=\"v-zaklyuchenie\">\u0412 \u0437\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h2>\n<p>  <\/p>\n<p>\u041d\u0430\u0432\u0435\u0440\u043d\u043e\u0435, \u043c\u043e\u0436\u043d\u043e \u0441\u0447\u0438\u0442\u0430\u0442\u044c \u0432\u0441\u044e \u044d\u0442\u0443 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044e \u043d\u0435\u043a\u0438\u043c \u0432\u0435\u043b\u043e\u0441\u0438\u043f\u0435\u0434\u043e\u043c. \u041d\u043e \u0432 \u044d\u043a\u0441\u043f\u043b\u0443\u0430\u0442\u0430\u0446\u0438\u0438 \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u043a\u043e\u043b\u043b\u0435\u0433\u0430\u043c \u0442\u0430\u043a\u043e\u0433\u043e \u0432\u0435\u043b\u043e\u0441\u0438\u043f\u0435\u0434\u0430 \u043d\u0430 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0443 \u0441\u0442\u0430\u043b\u043e \u0441\u0440\u0430\u0437\u0443 \u044f\u0441\u043d\u043e, \u0447\u0442\u043e \u043e\u043d \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u043a\u0430\u043a \u00ab\u0440\u0430\u043c\u0430+\u043a\u043e\u043b\u0435\u0441\u0430+\u043f\u0435\u0434\u0430\u043b\u0438+\u0440\u0443\u043b\u044c\u00bb, \u0438 \u0435\u0437\u0434\u0438\u0442\u044c \u043d\u0430 \u043d\u0435\u043c \u0443\u0434\u043e\u0431\u043d\u043e. \u0418 \u043f\u043e\u0447\u0442\u0438 \u0432 \u043e\u0431\u0441\u043b\u0443\u0436\u0438\u0432\u0430\u043d\u0438\u0438 \u043d\u0435 \u043d\u0443\u0436\u0434\u0430\u0435\u0442\u0441\u044f.<br \/>  \u0410 \u043b\u0443\u0447\u0448\u0435\u0439 \u043f\u043e\u0445\u0432\u0430\u043b\u043e\u0439 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0441\u0442\u0430\u043d\u0435\u0442 \u043c\u044b\u0441\u043b\u044c \u0447\u0438\u0442\u0430\u044e\u0449\u0435\u0433\u043e \u2014 \u201c\u0418\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435! \u041d\u0430\u0434\u043e \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c!\u201d.<\/p>\n<\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/company\/citymobil\/blog\/503246\/\"> https:\/\/habr.com\/ru\/company\/citymobil\/blog\/503246\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/company\/citymobil\/blog\/503246\/\">\n<blockquote><p>\u0417\u0430\u043a\u043e\u043d \u041f\u0430\u0440\u0435\u0442\u043e (\u043f\u0440\u0438\u043d\u0446\u0438\u043f \u041f\u0430\u0440\u0435\u0442\u043e, \u043f\u0440\u0438\u043d\u0446\u0438\u043f 80\/20) \u2014 \u00ab20 % \u0443\u0441\u0438\u043b\u0438\u0439 \u0434\u0430\u044e\u0442 80 % \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430, \u0430 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 80 % \u0443\u0441\u0438\u043b\u0438\u0439 \u2014 \u043b\u0438\u0448\u044c 20 % \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430\u00bb.<br \/>  <a href=\"https:\/\/ru.wikipedia.org\/wiki\/%D0%97%D0%B0%D0%BA%D0%BE%D0%BD_%D0%9F%D0%B0%D1%80%D0%B5%D1%82%D0%BE\">Wikipedia<\/a><\/p><\/blockquote>\n<p>\u041f\u0440\u0438\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e \u0442\u0435\u0431\u044f, \u0434\u043e\u0440\u043e\u0433\u043e\u0439 \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u044c!<\/p>\n<p>  <\/p>\n<p>\u041c\u043e\u044f \u043f\u0435\u0440\u0432\u0430\u044f \u0441\u0442\u0430\u0442\u044c\u044f \u043d\u0430 \u0425\u0430\u0431\u0440 \u043f\u043e\u0441\u0432\u044f\u0449\u0435\u043d\u0430 \u043f\u0440\u043e\u0441\u0442\u043e\u043c\u0443 \u0438, \u043d\u0430\u0434\u0435\u044e\u0441\u044c, \u043f\u043e\u043b\u0435\u0437\u043d\u043e\u043c\u0443 \u0440\u0435\u0448\u0435\u043d\u0438\u044e, \u0441\u0434\u0435\u043b\u0430\u0432\u0448\u0438\u043c \u0434\u043b\u044f \u043c\u0435\u043d\u044f \u0441\u0431\u043e\u0440 \u043c\u0435\u0442\u0440\u0438\u043a \u0432 Prometheus \u0441 \u0440\u0430\u0437\u043d\u043e\u0440\u043e\u0434\u043d\u044b\u0445 \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u0432 \u0443\u0434\u043e\u0431\u043d\u044b\u043c. \u042f \u0437\u0430\u0442\u0440\u043e\u043d\u0443 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0441\u0442\u0438, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043d\u043e\u0433\u0438\u0435 \u043c\u043e\u0433\u043b\u0438 \u043d\u0435 \u043f\u043e\u0433\u0440\u0443\u0436\u0430\u0442\u044c\u0441\u044f, \u044d\u043a\u0441\u043f\u043b\u0443\u0430\u0442\u0438\u0440\u0443\u044f Prometheus, \u0438 \u043f\u043e\u0434\u0435\u043b\u044e\u0441\u044c \u0441\u0432\u043e\u0438\u043c \u043f\u043e\u0434\u0445\u043e\u0434\u043e\u043c \u043f\u043e \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u0438 \u0432 \u043d\u0451\u043c \u043b\u0435\u0433\u043a\u043e\u0432\u0435\u0441\u043d\u043e\u0433\u043e service discovery.<br \/>  \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f: Prometheus, HashiCorp Consul, systemd, \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430 \u043d\u0430 Bash \u0438 \u043e\u0441\u043e\u0437\u043d\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u044f\u0449\u0435\u0433\u043e.<\/p>\n<p>  <\/p>\n<p>\u0415\u0441\u043b\u0438 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e \u0443\u0437\u043d\u0430\u0442\u044c, \u043a\u0430\u043a \u0432\u0441\u0435 \u044d\u0442\u043e \u0441\u0432\u044f\u0437\u0430\u043d\u043e \u0438 \u043a\u0430\u043a \u043e\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442, \u0434\u043e\u0431\u0440\u043e \u043f\u043e\u0436\u0430\u043b\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u0434 \u043a\u0430\u0442.<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/ne\/9h\/pe\/ne9hpett0pzkfg0cdv33q5o5rg0.png\" alt=\"Prometheus + Bash + Consul\"><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-304072","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/304072","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=304072"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/304072\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=304072"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=304072"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=304072"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}