{"id":12202,"date":"2023-03-16T15:46:52","date_gmt":"2023-03-16T07:46:52","guid":{"rendered":"https:\/\/blog.ywdevops.cn\/?p=12202"},"modified":"2023-03-16T16:45:33","modified_gmt":"2023-03-16T08:45:33","slug":"kube-scheduler","status":"publish","type":"post","link":"https:\/\/blog.ywdevops.cn\/index.php\/2023\/03\/16\/kube-scheduler\/","title":{"rendered":"\u901a\u8fc7\u591c\u83ba\u76d1\u63a7kube-scheduler"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">scheduler\u4e5f\u63d0\u4f9b\u4e86\u63a5\u53e3\u7528\u4e8e\u83b7\u53d6\u6570\u636e\uff0c\u7aef\u53e3\u4e3a10259\uff0c\u8d70https\u534f\u8bae\uff0c\u4f46\u662f\u9700\u8981\u8ba4\u8bc1\uff0c\u5982\u56fe\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"709\" height=\"223\" src=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2023\/03\/17-2.png\" alt=\"\" class=\"wp-image-12206\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2023\/03\/17-2.png 709w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2023\/03\/17-2-300x94.png 300w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2023\/03\/17-2-600x189.png 600w\" sizes=\"auto, (max-width: 709px) 100vw, 709px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">\u672c\u4f8b\u5b50\u4e2d\u7ee7\u7eed\u590d\u7528apiserver\u76d1\u63a7\u4e00\u7ae0\u751f\u6210\u7684token<a href=\"https:\/\/blog.ywdevops.cn\/index.php\/2023\/03\/15\/kube-apiserver\/\">\u901a\u8fc7\u591c\u83ba\u76d1\u63a7kube-apiserver \u2013 IT\u8fd0\u7ef4 (blog.ywdevops.cn)<\/a><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">1\u3001\u4fee\u6539kube-scheduler\u914d\u7f6e\u6587\u4ef6\uff0c\u4fee\u6539\u5730\u5740\u4e3a0.0.0.0\uff0c\u5982\u56fe\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"708\" height=\"246\" src=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2023\/03\/18-1.png\" alt=\"\" class=\"wp-image-12209\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2023\/03\/18-1.png 708w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2023\/03\/18-1-300x104.png 300w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2023\/03\/18-1-600x208.png 600w\" sizes=\"auto, (max-width: 708px) 100vw, 708px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">2\u3001\u4fee\u6539prometheus.yaml\u6587\u4ef6\uff0c\u6dfb\u52a0\u5185\u5bb9\u5982\u4e0b\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>- job_name: 'kube_scheduler'\r\n        kubernetes_sd_configs:\r\n        - role: endpoints\r\n        scheme: https\r\n        tls_config:\r\n          insecure_skip_verify: true\r\n        authorization:\r\n          credentials_file: \/var\/run\/secrets\/kubernetes.io\/serviceaccount\/token\r\n        relabel_configs:\r\n        - source_labels: &#91;__meta_kubernetes_namespace, __meta_kubernetes_service_name, __meta_kubernetes_endpoint_port_name]\r\n          action: keep\r\n          regex: kube-system;kube-scheduler;https\r<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u4e0a\u9762\u6807\u7b7e\u4e2d\u7684service name\u4e0d\u5b58\u5728\uff0c\u56e0\u6b64\u9700\u8981\u5355\u72ec\u521b\u5efa\uff0c\u6267\u884c\u5982\u4e0b\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>apiVersion: v1\r\nkind: Service\r\nmetadata:\r\n  namespace: kube-system\r\n  name: kube-scheduler\r\n  labels:\r\n    k8s-app: kube-scheduler\r\nspec:\r\n  selector:\r\n    component: kube-scheduler\r\n  type: ClusterIP\r\n  clusterIP: None\r\n  ports:\r\n  - name: https\r\n    port: 10259\r\n    targetPort: 10259\r\n    protocol: TCP<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"709\" height=\"157\" src=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2023\/03\/1-7.png\" alt=\"\" class=\"wp-image-12213\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2023\/03\/1-7.png 709w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2023\/03\/1-7-300x66.png 300w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2023\/03\/1-7-600x133.png 600w\" sizes=\"auto, (max-width: 709px) 100vw, 709px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">3\u3001\u6267\u884c\u8d44\u6e90\u6587\u4ef6prometheus.yml\uff0c\u5e76\u91cd\u542fprometheus agent  pod\uff0c\u5982\u4e0b\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>kubectl apply -f prometheus.yml\nkubectl rollout restart deploy prometheus-agent -n monitor<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">4\u3001\u901a\u8fc7\u591c\u83ba\u670d\u52a1\u7aef\u9875\u9762\u5373\u65f6\u67e5\u8be2\u6307\u6807\uff0c\u5982\u56fe\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"708\" height=\"286\" src=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2023\/03\/2-6.png\" alt=\"\" class=\"wp-image-12217\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2023\/03\/2-6.png 708w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2023\/03\/2-6-300x121.png 300w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2023\/03\/2-6-600x242.png 600w\" sizes=\"auto, (max-width: 708px) 100vw, 708px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">\u5173\u952e\u6307\u6807\u5982\u4e0b\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># HELP rest_client_request_duration_seconds &#91;ALPHA] Request latency in seconds. Broken down by verb and URL.\r\n# TYPE rest_client_request_duration_seconds histogram\r\n\u8bf7\u6c42apiserver\u7684\u5ef6\u8fdf\u5206\u5e03\r\n\r\n# HELP rest_client_requests_total &#91;ALPHA] Number of HTTP requests, partitioned by status code, method, and host.\r\n# TYPE rest_client_requests_total counter\r\n\u8bf7\u6c42apiserver\u7684\u603b\u6570 ,\u6309\u7167host code method \u7edf\u8ba1\r\n\r\n# HELP leader_election_master_status &#91;ALPHA] Gauge of if the reporting system is master of the relevant lease, 0 indicates backup, 1 indicates master. 'name' is the string used to identify the lease. Please make sure to group by name.\r\n# TYPE leader_election_master_status gauge\r\n\u8c03\u5ea6\u5668\u7684\u9009\u4e3e\u72b6\u6001\uff0c0\u8868\u793abackup\uff0c 1\u8868\u793amaster\r\n\r\n# HELP scheduler_queue_incoming_pods_total &#91;STABLE] Number of pods added to scheduling queues by event and queue type.\r\n# TYPE scheduler_queue_incoming_pods_total counter\r\n\u8fdb\u5165\u8c03\u5ea6\u961f\u5217\u7684pod\u6570\r\n\r\n# HELP scheduler_preemption_attempts_total &#91;STABLE] Total preemption attempts in the cluster till now\r\n# TYPE scheduler_preemption_attempts_total counter\r\n\u8c03\u5ea6\u5668\u9a71\u9010\u5bb9\u5668\u7684\u6b21\u6570\r\n\r\n# HELP scheduler_scheduler_cache_size &#91;ALPHA] Number of nodes, pods, and assumed (bound) pods in the scheduler cache.\r\n# TYPE scheduler_scheduler_cache_size gauge\r\n\u8c03\u5ea6\u5668cache\u4e2dnode pod\u548c\u7ed1\u5b9apod\u7684\u6570\u76ee\r\n\r\n# HELP scheduler_pending_pods &#91;STABLE] Number of pending pods, by the queue type. 'active' means number of pods in activeQ; 'backoff' means number of pods in backoffQ; 'unschedulable' means number of pods in unschedulableQ.\r\n# TYPE scheduler_pending_pods gauge\r\n\u8c03\u5ea6pending\u7684pod\u6570\u91cf\uff0c\u6309\u7167queue type\u5206\u522b\u7edf\u8ba1\r\n\r\n# HELP scheduler_plugin_execution_duration_seconds &#91;ALPHA] Duration for running a plugin at a specific extension point.\r\n# TYPE scheduler_plugin_execution_duration_seconds histogram\r\n\u8c03\u5ea6\u63d2\u4ef6\u5728\u6bcf\u4e2a\u6269\u5c55\u70b9\u7684\u6267\u884c\u65f6\u95f4\uff0c\u6309\u7167extension_point+plugin+status \u5206\u522b\u7edf\u8ba1\r\n\r\n# HELP scheduler_e2e_scheduling_duration_seconds &#91;ALPHA] (Deprecated since 1.23.0) E2e scheduling latency in seconds (scheduling algorithm + binding). This metric is replaced by scheduling_attempt_duration_seconds.\r\n# TYPE scheduler_e2e_scheduling_duration_seconds histogram\r\n\u8c03\u5ea6\u5ef6\u8fdf\u5206\u5e03\uff0c1.23.0 \u4ee5\u540e\u4f1a\u88abscheduling_attempt_duration_seconds\u66ff\u4ee3\r\n\r\n# HELP scheduler_framework_extension_point_duration_seconds &#91;STABLE] Latency for running all plugins of a specific extension point.\r\n# TYPE scheduler_framework_extension_point_duration_seconds histogram\r\n\u8c03\u5ea6\u6846\u67b6\u7684\u6269\u5c55\u70b9\u5ef6\u8fdf\u5206\u5e03,\u6309extension_point(\u6269\u5c55\u70b9Bind Filter Permit PreBind\/PostBind PreFilter\/PostFilter Reseve)\r\n+profile\uff08\u8c03\u5ea6\u5668\uff09+ status(\u8c03\u5ea6\u6210\u529f) \u7edf\u8ba1\r\n\r\n# HELP scheduler_pod_scheduling_attempts &#91;STABLE] Number of attempts to successfully schedule a pod.\r\n# TYPE scheduler_pod_scheduling_attempts histogram\r\npod\u8c03\u5ea6\u6210\u529f\u524d\uff0c\u8c03\u5ea6\u91cd\u8bd5\u7684\u6b21\u6570\u5206\u5e03\r\n\r\n# HELP scheduler_schedule_attempts_total &#91;STABLE] Number of attempts to schedule pods, by the result. 'unschedulable' means a pod could not be scheduled, while 'error' means an internal scheduler problem.\r\n# TYPE scheduler_schedule_attempts_total counter\r\n\u6309\u7167\u8c03\u5ea6\u7ed3\u679c\u7edf\u8ba1\u7684\u8c03\u5ea6\u91cd\u8bd5\u6b21\u6570\u3002 \"unschedulable\" \u8868\u793a\u65e0\u6cd5\u8c03\u5ea6\uff0c\"error\"\u8868\u793a\u8c03\u5ea6\u5668\u5185\u90e8\u9519\u8bef\r\n\r\n# HELP scheduler_scheduler_goroutines &#91;ALPHA] Number of running goroutines split by the work they do such as binding.\r\n# TYPE scheduler_scheduler_goroutines gauge\r\n\u6309\u7167\u529f\u80fd(binding filter\u4e4b\u7c7b)\u7edf\u8ba1\u7684goroutine\u6570\u91cf\r\n\r\n# HELP scheduler_scheduling_algorithm_duration_seconds &#91;ALPHA] Scheduling algorithm latency in seconds\r\n# TYPE scheduler_scheduling_algorithm_duration_seconds histogram\r\n\u8c03\u5ea6\u7b97\u6cd5\u7684\u8017\u65f6\u5206\u5e03\r\n\r\n# HELP scheduler_scheduling_attempt_duration_seconds &#91;STABLE] Scheduling attempt latency in seconds (scheduling algorithm + binding)\r\n# TYPE scheduler_scheduling_attempt_duration_seconds histogram\r\n\u8c03\u5ea6\u7b97\u6cd5+binding\u7684\u8017\u65f6\u5206\u5e03\r\n\r\n# HELP scheduler_scheduler_goroutines &#91;ALPHA] Number of running goroutines split by the work they do such as binding.\r\n# TYPE scheduler_scheduler_goroutines gauge\r\n\u8c03\u5ea6\u5668\u7684goroutines\u6570\u76ee<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>scheduler\u4e5f\u63d0\u4f9b\u4e86\u63a5\u53e3\u7528\u4e8e\u83b7\u53d6\u6570\u636e\uff0c\u7aef\u53e3\u4e3a10259\uff0c\u8d70https\u534f\u8bae\uff0c\u4f46\u662f\u9700\u8981\u8ba4\u8bc1\uff0c\u5982\u56fe\uff1a \u672c\u4f8b\u5b50\u4e2d [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":12203,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[93,109],"tags":[],"class_list":["post-12202","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-kubernetes","category-didi"],"blocksy_meta":{"styles_descriptor":{"styles":{"desktop":"","tablet":"","mobile":""},"google_fonts":[],"version":8}},"_links":{"self":[{"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/posts\/12202","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/comments?post=12202"}],"version-history":[{"count":13,"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/posts\/12202\/revisions"}],"predecessor-version":[{"id":12220,"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/posts\/12202\/revisions\/12220"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/media\/12203"}],"wp:attachment":[{"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/media?parent=12202"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/categories?post=12202"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/tags?post=12202"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}