Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Example Analysis of metrics-server

2025-01-20 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)05/31 Report--

Today, I will talk to you about the example analysis of metrics-server. Many people may not know much about it. In order to make you understand better, the editor has summarized the following for you. I hope you can get something according to this article.

1 download the project

Git clone https://github.com/kubernetes-incubator/metrics-server.git

2 modify the configuration file

Cd / root/metrics-server/deploy/1.8+ [root@master 1.8 +] # vim metrics-server-deployment.yaml-apiVersion: v1kind: ServiceAccountmetadata: name: metrics-server namespace: kube-system---apiVersion: extensions/v1beta1kind: Deploymentmetadata: name: metrics-server namespace: kube-system labels: k8s-app: metrics-serverspec: selector: matchLabels: k8s-app: metrics-server template: metadata: name: metrics-server labels: K8s-app: metrics-server spec: serviceAccountName: metrics-server volumes: # mount in tmp so we can safely use from-scratch images and/or read-only containers-name: tmp-dir emptyDir: {} containers:-name: metrics-server image: k8s.gcr.io/metrics-server-amd64:v0.3.1 imagePullPolicy: Always command:-/ metrics -server-kubelet-insecure-tls-kubelet-preferred-address-types=InternalIP volumeMounts:-name: tmp-dir mountPath: / tmp add configuration command:-/ metrics-server-kubelet-insecure-tls-kubelet-preferred-address-types=InternalIP

3 Application profile

Kubectl apply-f.

4 View pod

# kubectl get pod-n kube-systemNAME READY STATUS RESTARTS AGEcalico-node-j85f7 2 3h7mcalico-node-tbvs4 2 Running 2 3h7mcalico-node-tbvs4 2 Running 2 3h4mcalico-node-zwsts 2 3h5mcalico-typha-55968bfd7b-zv9vc 2 Running 2 3h5mcalico-typha-55968bfd7b-zv9vc 1 Running 1 3h7mcoredns-fb8b8dccf-227fk 1 + 1 Running 0 54mcoredns-fb8b8dccf-xwscm 1 + 1 Running 0 54metcd-master 1 + 1 Running 1 3h21mkube-apiserver-master 1 + 1 Running 1 3h21mkube-controller-manager-master 1 + + 1 Running 1 3h 21mkube- Proxy-ltwbd 1/1 Running 0 55mkube-proxy-qgrvg 1/1 Running 0 55mkube-proxy-xnd45 1/1 Running 0 55mkube-scheduler-master 1/1 Running 1 3h21mmetrics-server-58db9f9647-sxtv9 1/1 Running 0 6m42s

5 use

# kubectl top nodeNAME CPU (cores) CPU% MEMORY (bytes) MEMORY% master 189m 4% 911Mi 24% node1 98m 2% 432Mi 5% node2 117m 2% 442Mi 5% # kubectl top podsNAME CPU (cores) MEMORY (bytes) net-test-7d6d58cc8 -8r28m 0m 1Mi net-test-7d6d58cc8-k5qdm 0m 1Mi # kubectl top pods-n kube-systemNAME CPU (cores) MEMORY (bytes) calico-node-j85f7 29m 59Mi calico-node-tbvs4 25m 61Mi calico- Node-zwsts 27m 60Mi calico-typha-55968bfd7b-zv9vc 9m 29Mi coredns-fb8b8dccf-227fk 4m 13Mi coredns-fb8b8dccf-xwscm 4m 13Mi etcd-master 25m 69Mi kube-apiserver-master 34m 270Mi kube-controller-manager-master 16m 57Mi kube-proxy-ltwbd 1m 17Mi kube-proxy-qgrvg 1m 17Mi kube-proxy-xnd45 1m 18Mi kube-scheduler-master 2m 15Mi metrics-server-58db9f9647-sxtv9 2m 14Mi

6 View Metrics API data

Start an agent so that curl apikubectl proxy-- port=8080# can view interface data directly: # available resources: nodes and pods# curl localhost:8080/apis/metrics.k8s.io/v1beta1 curl localhost:8080/apis/metrics.k8s.io/v1beta1/ {"kind": "APIResourceList", "apiVersion": "v1", "groupVersion": "metrics.k8s.io/v1beta1", "resources": [{"name": "nodes" "singularName": "," namespaced ": false," kind ":" NodeMetrics "," verbs ": [" get "," list "]}, {" name ":" pods "," singularName ":"," namespaced ": true," kind ":" PodMetrics "," verbs ": [" get " "list"]}]} after reading the above content Do you have any further understanding of the sample analysis of metrics-server? If you want to know more knowledge or related content, please follow the industry information channel, thank you for your support.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report