سرویس کوبرنتیز ستون تعدادی metric از API-server و کامپوننتهای تحت مدیریت خود مانند Calico و CoreDNS و SotoonCSI جمع آوری میکند که میتواند با استفاده از remote-write در prometheus این متریکها را در اختیار کاربران نیز قرار دهد. برای این مورد نیاز است تا کاربر یک remote-write target معرفی کند تا متریکها به آن ارسال شوند.
remote write target چیست
یک remote-write target میتواند یک prometheus باشد که feature-gate مربوط به remote-write-reciever روی آن فعال شده است یا اینکه یک پایگاهداده مثل M3 باشد که میتواند برای این کار با promethues استفاده شود و کاملا یکپارچه (integrate) است. برای مشاهدهی لیست کاملی از پایگاهدادههایی که پشتیبانی میشوند میتوانید این لینک را مشاهده کنید.
یک remote-write target باید از نظر شبکه به صورتی باشد که یک Pod داخل کلاستر بتواند به endpoint معرفی شده برای آن ریکوئست HTTP ارسال کند. این remote-write target میتواند یک pod یا یک سرویس داخل کلاستر کوبرنتیز شما باشد، ممکن است آدرس یک ماشین روی سابنتی باشد که کلاستر کوبرنتیز شما در آن قرار دارد و امکان مشاهدهی آن حتی از طریق اینترنت هم ممکن است.
توضیحات مربوط به تنظیمات
تنظیمات شما بسیار شبیه به تنظیمات remote-write در prometheus است که میتوانید توضیحات مربوط به آن را در این لینک مشاهده کنید. فقط برخی از فیلدها تحت پشتیبانی نیستند. تنظیمات شما باید در قالب زیر باشد:
# Required: The URL of the endpoint to send samples to.
url: <string>
# Timeout for requests to the remote write endpoint.
[ remote_timeout: <duration> | default = 30s ]
# Optional: Custom HTTP headers to be sent along with each remote write request.
# Be aware that headers that are set by Prometheus itself can't be overwritten.
headers:
[ <string>: <string> ... ]
# Optional: Sets the `Authorization` header on every remote write request with the
# configured username and password.
basic_auth:
[ username: <string> ]
[ password: <string> ]
# Optional `Authorization` header configuration.
authorization:
# Sets the authentication type.
[ type: <string> | default: Bearer ]
# Sets the credentials.
[ credentials: <string> ]
# Optional OAuth 2.0 configuration.
# Cannot be used at the same time as basic_auth, authorization.
oauth2:
client_id: <string>
[ client_secret: <string> ]
# Scopes for the token request.
scopes:
[ - <string> ... ]
# The URL to fetch the token from.
token_url: <string>
# Optional parameters to append to the token URL.
endpoint_params:
[ <string>: <string> ... ]
# Configures the token request's TLS settings.
tls_config:
# Disable validation of the server certificate.
[ insecure_skip_verify: <boolean> ]
# Optional proxy URL.
[ proxy_url: <string> ]
# Comma-separated string that can contain IPs, CIDR notation, domain names
# that should be excluded from proxying. IP and domain names can
# contain port numbers.
[ no_proxy: <string> ]
# Specifies headers to send to proxies during CONNECT requests.
[ proxy_connect_header:
[ <string>: [ <string>, ... ] ] ]
# Optional: Configures the remote write request's TLS settings.
tls_config:
# Disable validation of the server certificate.
[ insecure_skip_verify: <boolean> ]
# Optional proxy URL.
[ proxy_url: <string> ]
# Comma-separated string that can contain IPs, CIDR notation, domain names
# that should be excluded from proxying. IP and domain names can
# contain port numbers.
[ no_proxy: <string> ]
# Specifies headers to send to proxies during CONNECT requests.
[ proxy_connect_header:
[ <string>: [<string>, ...] ] ]
مثال:
url: http://prometheus-service.namespace.svc.cluster.local:9090/api/v1/write
basic_auth:
username: my_username
password: my_password
remote_timeout: 300s
tls_config:
insecure_skip_verify: true
برای اعمال تنظیمات میتوانید به پشتیبانی سرویس کوبرنیتیز ستون مراجعه کنید و کانفیگ خود را برای آنها ارسال کنید.
نکته: توجه داشته باشید که ممکن است نهاییسازی تغییرات کانفیگها به زمان کوتاهی در حد چند دقیقه نیاز داشته باشد.
متریکهای ارسال
Metric | Component |
---|---|
All Metrics | Node Exporter |
coredns_build_info | CoreDNS |
coredns_plugin_enabled | |
coredns_dns_requests_total | |
coredns_dns_do_requests_total | |
coredns_dns_request_size_bytes_bucket | |
coredns_dns_responses_total | |
coredns_dns_request_duration_seconds_bucket | |
coredns_dns_response_size_bytes_bucket | |
coredns_cache_entries | |
coredns_cache_hits_total | |
coredns_cache_misses_total | |
felix_active_local_endpoints | Calico/Felix |
felix_iptables_lines_executed | |
felix_cluster_num_policies | |
felix_iptables_save_errors | |
felix_ipset_errors | |
felix_cluster_num_hosts | |
felix_iptables_restore_errors | |
felix_log_errors | |
felix_resyncs_started | |
felix_logs_dropped | |
felix_int_dataplane_apply_time_seconds | |
felix_route_table_list_seconds | |
ipam_allocations_borrowed | Calico/Controllers |
ipam_allocations_gc_candidates | |
ipam_allocations_in_use | |
ipam_allocations_per_node | |
ipam_blocks | |
ipam_blocks_per_node | |
ipam_ippool_size | |
sotoon_csi_controller_plugin_active_locks | SotoonCSI |
sotoon_csi_controller_plugin_volume_attachment_seconds_bucket | |
sotoon_csi_controller_plugin_volume_attachment_seconds_sum | |
sotoon_csi_controller_plugin_volume_attachment_seconds_count | |
sotoon_csi_controller_plugin_volume_attachment_errors | |
sotoon_csi_controller_plugin_volume_attachment_error_seconds_bucket | |
sotoon_csi_controller_plugin_volume_attachment_error_seconds_sum | |
sotoon_csi_controller_plugin_volume_attachment_error_seconds_count | |
sotoon_csi_controller_plugin_volume_detachment_errors | |
sotoon_csi_controller_plugin_volume_detachment_seconds_bucket | |
sotoon_csi_controller_plugin_volume_detachment_seconds_sum | |
sotoon_csi_controller_plugin_volume_detachment_seconds_count |
نکته
- تمامی این متریکها در صورت پشتیبانی از آخرین ورژن ادانها یعنی Calico ،CoreDNS و SotoonCSI و… برای شما ارسال میشود. بنابراین در نظر داشته باشید نسخههای قدیمیتر ممکن است همهی متریکهای نوشته شده را پشتیبانی نکنند.
- دشبورد مربوط به متریکهای SotoonCSI را میتوانید از این آدرس به صورت Json دانلود کرده و در پنل Grafana مورد نظر خود، Import نمایید.