In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/03 Report--
# I. introduction to metrics-server
Since kubernetes 1.8, resource usage metrics (such as container CPU and memory usage) have been obtained in Kubernetes through Metrics API, and metrics-server has replaced heapster. Metrics Server implements that Resource Metrics API,Metrics Server is an aggregator of cluster-wide resource usage data.
Metrics Server collects metric information from the Summary API exposed by the Kubelet on each node.
Some components in Kubernetes rely on the functions of the resource indicator API (metric API), such as kubectl top, hpa. These components cannot run without the resource metrics API interface. In the past, Heapster,Heapster was used instead of metrics-server.
Through Metrics API, you can obtain the current resource usage of a specified node or pod (but not historical data) the api path of Metrics API: / apis/metrics.k8s.io/Metrics API requires the successful deployment of metrics server in the K8S cluster
Kubernetes metrics server reference documentation https://github.com/kubernetes-incubator/metrics-server
# II. Install metrics-server
1. Download the required file # mkdir. / metrics-server # cd metrics-server/ # for file in aggregated-metrics-reader.yaml auth-delegator.yaml auth-reader.yaml metrics-apiservice.yaml metrics-server-deployment.yaml metrics-server-service.yaml resource-reader.yaml; do wget https://raw.githubusercontent.com/kubernetes-incubator/metrics-server/master/deploy/1.8%2B/$file; Done 2. There are two areas that need to be changed here, one is the image problem, and the other is the service startup problem. # execute on all Node nodes. First download the mirror source of the mirror Guotong Ali Yun. Change the name again. Docker pull registry.cn-hangzhou.aliyuncs.com/google_containers/metrics-server-amd64:v0.3.3 docker tag registry.cn-hangzhou.aliyuncs.com/google_containers/metrics-server-amd64:v0.3.3 k8s.gcr.io/metrics-server-amd64:v0.3.3 # modify metrics-server-deployment.yaml, add an imagePullPolicy, and add command content, otherwise an error no metrics known for node will be reported. Baidu is the cause of the related problems. # vim metrics-server-deployment.yaml 30 containers: 31-name: metrics-server 32 image: k8s.gcr.io/metrics-server-amd64:v0.3.3 33 imagePullPolicy: IfNotPresent 34 command: 35-/ metrics-server 36-kubelet-preferred-address-types=InternalIP,Hostname,InternalDNS,ExternalDNS ExternalIP 37-kubelet-insecure-tls 38 volumeMounts: 39-name: tmp-dir 40 mountPath: / tmp # kubectl apply-f. / clusterrole.rbac.authorization.k8s.io/system:aggregated-metrics-reader created clusterrolebinding.rbac.authorization.k8s.io/metrics-server:system:auth-delegator created rolebinding.rbac.authorization.k8s.io/metrics-server-auth-reader created apiservice.apiregistration.k8s.io / v1beta1.metrics.k8s.io created serviceaccount/metrics-server created deployment.extensions/metrics-server created service/metrics-server created clusterrole.rbac.authorization.k8s.io/system:metrics-server created clusterrolebinding.rbac.authorization.k8s.io/system:metrics-server created 3 、 Check pod status metrics-server-55898485b6-pdhnz 1 Running 0 93m 10.244.4.2 huoban-k8s-node01 4, check node resource usage (be sure to wait a few minutes Kubectl top node NAME CPU (cores) CPU% MEMORY (bytes) MEMORY% huoban-k8s-master01 72m 3% 612Mi 16% huoban-k8s-master02 93m 4% 713Mi 19% huoban-k8s-master03 108m 5 674Mi 18% huoban -k8s-node01 26m 1% 334Mi 9% huoban-k8s-node02 26m 1% 339Mi 9% 5, View pod resource usage # kubectl top pods-n kube-systemNAME CPU (cores) MEMORY (bytes) coredns-6967fb4995- 4qlfb 1m 13Micoredns-6967fb4995-frv2p 1m 12Mietcd-huoban-k8s-master01 22m 358Mietcd-huoban-k8s-master02 25m 364Mietcd-huoban-k8s-master03 23m 381Mikube-apiserver-huoban-k8s-master01 15m 267Mikube-apiserver-huoban-k8s-master02 13m 255Mikube-apiserver-huoban-k8s-master03 17m 249Mikube-controller-manager-huoban-k8s-master01 7m 69Mikubehouse controller house management house huobanlu k8s- Master02 0m 14Mikube-controller-manager-huoban-k8s-master03 0m 14Mikube-flannel-ds-amd64-6bp76 1m 21Mikube-flannel-ds-amd64-nrvvz 1m 15Mikube-flannel-ds-amd64-shv4n 1m 16Mikube-flannel-ds-amd64-t77n4 1m 15Mikube-proxy-8d522 1m 19Mikube-proxy-9ng4j 1m 18Mikube-proxy-htw7p 1m 20Mikube-proxy-n9r48 1m 17Mikube-proxy-nsqgh 1m 17Mikube-scheduler-huoban-k8s-master01 1m 27Mikube-scheduler-huoban-k8s-master02 0m 16Mikube-scheduler-huoban-k8s-master03 0m 13Mikubernetes-dashboard-86844cc55f-sz4gn 0m 13Mimetrics-server-d9d75756b-l75wj 1m 17Mi
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.