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

How to deploy Metrics Server Services in Kubernetes Cluster

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article mainly explains "how to deploy Metrics Server service in Kubernetes Cluster". The explanation in this article is simple and clear, easy to learn and understand. Please follow the ideas of Xiaobian and study and learn "how to deploy Metrics Server service in Kubernetes Cluster" together!

problem description

This note will document how to deploy Metrics Server services in Kubernetes Cluster and how to handle common problems.

solutions

Our test environment is Kubernetes Cluster v1.16.

Step 1: Environmental inspection

Metrics Server has special requirements for networks and clusters. This requirement is not the default configuration in some clusters, so make sure you meet it first.

1)Metrics Server must be reachable from kube-apiserver

2)The kube-apiserver must be correctly configured to enable an aggregation layer

Check the/etc/kubernetes/manifests/kube-apiserver.yaml option, which is enabled by default.

3)Nodes must have kubelet authorization configured to match Metrics Server configuration

4)Container runtime must implement a container metrics RPCs

Step 2: Modify configuration information

Download the components.yaml file and modify it as needed:

1) We need to modify the mirror address in the YAML file to use a private mirror repository;

Default image belongs to k8s.gcr.io repository, pulling will fail, modified to bitnami/metrics-server:0.4.2

2) Add--kubelet-preferred-address-types=InternalIP and--kubelet-insecure-tls options;

Step 3: Apply the configuration file # kubectl apply -f "/path/to/components.yaml"# kubectl get -n kube-system pods -l k8s-app=metrics-serverNAME READY STATUS RESTARTS AGEmetrics-server-66d4d747c4-nmzs6 1/1 Running 0 8m19s Step 4: View Pod Resource Usage # kubectl top node --sort-by=cpu...# kubectl top pod --all-namespaces --containers... Metrics not available for pod# kubectl top -n kube-system podW0702 10:48:07.400630 6619 top_pod.go:266] Metrics not available for pod kube-system/coredns-58cc8c89f4-6czm4, age: 4267h8m49.400600321serror: Metrics not available for pod kube-system/coredns-58cc8c89f4-6czm4, age: 4267h8m49.400600321s

Resolved by adding--kubelet-preferred-address-types=InternalIP and--kubelet-insecure-tls options;

unable to fetch pod metrics for podE0702 02:39:09.777832 1 reststorage.go:160] unable to fetch pod metrics for pod default/counter: no metrics known for podE0702 02:39:09.777843 1 reststorage.go:160] unable to fetch pod metrics for pod kube-system/etcd-k8s-master-02: no metrics known for podE0702 02:39:09.777863 1 reststorage.go:160] unable to fetch pod metrics for pod kube-system/fluentd-p6d29: no metrics known for podE0702 02:39:09.777874 1 reststorage.go:160] unable to fetch pod metrics for pod kube-system/kube-proxy-xdh3z: no metrics known for podE0702 02:39:09.777885 1 reststorage.go:160] unable to fetch pod metrics for pod kube-system/etcd-k8s-master-01: no metrics known for podE0702 02:39:09.777900 1 reststorage.go:160] unable to fetch pod metrics for pod kube-system/kube-proxy-jrpnd: no metrics known for pod

Resolved by adding--kubelet-preferred-address-types=InternalIP and--kubelet-insecure-tls options

Thank you for reading, the above is "How to deploy Metrics Server service in Kubernetes Cluster" content, after learning this article, I believe you have a deeper understanding of how to deploy Metrics Server service in Kubernetes Cluster, the specific use situation still needs to be verified by practice. Here is, Xiaobian will push more articles related to knowledge points for everyone, welcome to pay attention!

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

Development

Wechat

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

12
Report