Merge pull request #29022 from geekpi/translating

Translating
This commit is contained in:
geekpi 2023-04-03 08:47:13 +08:00 committed by GitHub
commit 28f54a833c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 132 additions and 116 deletions

View File

@ -1,114 +0,0 @@
[#]: subject: "How to Install Kubernetes (K8s) Metrics Server Step by Step"
[#]: via: "https://www.linuxtechi.com/how-to-install-kubernetes-metrics-server/"
[#]: author: "Pradeep Kumar https://www.linuxtechi.com/author/pradeep/"
[#]: collector: "lkxed"
[#]: translator: "geekpi"
[#]: reviewer: " "
[#]: publisher: " "
[#]: url: " "
How to Install Kubernetes (K8s) Metrics Server Step by Step
======
In this post, we will cover to how to install Kubernetes metrics server step by step.
The Kubernetes(k8s) Metrics Server is a component that collects and aggregates metrics data from various sources in the Kubernetes cluster, including nodes and pods. This data can be used to monitor and optimize resource utilization, identify potential issues, and improve the overall performance of your Kubernetes cluster.
Metrics Server collects resource utilization data such as CPU and memory usage for nodes and pods in the cluster. It provides an API endpoint that can be used to query this data and retrieve metrics for specific resources in the cluster.
##### Prerequisites
- A Kubernetes cluster (v1.21 or high) up and running.
- kubectl command line tool installed and configured to interact to your Kubernetes cluster.
- The ability to create and modify Kubernetes objects.
Without any further delay, lets deep dive into the installation steps.
### Step 1) Download Metrics Server Manifest
The first step is to download the latest Metrics Server manifest file from the Kubernetes GitHub repository. Use below curl command to download yaml file,
```
# curl -LO https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/components.yaml
```
If you are planning to install metrics server in high availability mode then download following manifest file.
```
# curl https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/high-availability-1.21+.yaml
```
### Step 2) Modify Metrics Server Yaml File
Next, you need to modify the Metrics Server yaml file to set some configuration options,
```
# vi components.yaml
```
Find the args section under the container section, add the following line:
```
- --kubelet-insecure-tls
```
Under the spec section, add following parameter,
```
hostNetwork: true
```
Save and close the file.
### Step 3) Deploy Metrics Server
Now, we are all set to deploy metrics server, run following kubectl command,
```
# kubectl apply -f components.yaml
```
### Step 4) Verify Metrics Server Deployment
After deploying the Metrics Server, verify its status by checking the pods status which is running in the kube-system namespace,
```
# kubectl get pods -n kube-system
```
Output above confirms that metrics-server pod is up and running.
### Step 5) Test Metrics Server Installation
Finally, you can test the metrics server by running following kubectl command,
```
# kubectl top nodes
```
This command should display the resource utilization for each node in your cluster, including CPU and memory usage.
To view pods resource utilization of your current namespace or specific namespace, run
```
# kubectl top pod
# kubectl top pod -n kube-system
```
Thats all from this post, I have hope you found it informative. Please do post your feedback and queries in below comments section.
Also Read: How to Install and Use Helm in Kubernetes
--------------------------------------------------------------------------------
via: https://www.linuxtechi.com/how-to-install-kubernetes-metrics-server/
作者:[Pradeep Kumar][a]
选题:[lkxed][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://www.linuxtechi.com/author/pradeep/
[b]: https://github.com/lkxed/

View File

@ -2,7 +2,7 @@
[#]: via: "https://opensource.com/article/23/4/emojicode" [#]: via: "https://opensource.com/article/23/4/emojicode"
[#]: author: "Jessica Cherry https://opensource.com/users/cherrybomb" [#]: author: "Jessica Cherry https://opensource.com/users/cherrybomb"
[#]: collector: "lkxed" [#]: collector: "lkxed"
[#]: translator: " " [#]: translator: "geekpi"
[#]: reviewer: " " [#]: reviewer: " "
[#]: publisher: " " [#]: publisher: " "
[#]: url: " " [#]: url: " "
@ -189,4 +189,4 @@ via: https://opensource.com/article/23/4/emojicode
[3]: https://www.emojicode.org/docs/ [3]: https://www.emojicode.org/docs/
[4]: https://www.emojicode.org/docs/guides/ [4]: https://www.emojicode.org/docs/guides/
[5]: https://opensource.com/sites/default/files/2023-03/emoji.webp [5]: https://opensource.com/sites/default/files/2023-03/emoji.webp
[6]: https://github.com/emojicode/emojicode/issues [6]: https://github.com/emojicode/emojicode/issues

View File

@ -0,0 +1,130 @@
[#]: subject: "How to Install Kubernetes (K8s) Metrics Server Step by Step"
[#]: via: "https://www.linuxtechi.com/how-to-install-kubernetes-metrics-server/"
[#]: author: "Pradeep Kumar https://www.linuxtechi.com/author/pradeep/"
[#]: collector: "lkxed"
[#]: translator: "geekpi"
[#]: reviewer: " "
[#]: publisher: " "
[#]: url: " "
如何逐步安装 Kubernetes (K8s) 指标服务器
======
在这篇文章中,我们将逐步介绍如何安装 Kubernetes 指标服务器。
Kubernetes(k8s) 指标服务器是一个组件,用于收集和聚合来自 Kubernetes 集群中各种来源(包括节点和 Pod的指标数据。此数据可用于监控和优化资源利用率、识别潜在问题并提高 Kubernetes 集群的整体性能。
指标服务器收集资源利用率数据,例如集群中节点和 Pod 的 CPU 和内存使用情况。它提供了一个 API 端点,可用于查询此数据并检索集群中特定资源的指标。
##### 先决条件
- 启动并运行 Kubernetes 集群v1.21 或更高版本)。
- kubectl 命令行工具已安装并配置为与你的 Kubernetes 集群交互。
- 创建和修改 Kubernetes 对象的能力。
事不宜迟,让我们深入了解安装步骤。
### 步骤 1) 下载指标服务器清单
第一步是从 Kubernetes GitHub 仓库下载最新的指标服务器清单文件。使用下面的 curl 命令下载 yaml 文件:
```
# curl -LO https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/components.yaml
```
![][1]
如果你计划在高可用性模式下安装指标服务器,请下载以下清单文件:
```
# curl https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/high-availability-1.21+.yaml
```
### 步骤 2修改指标服务器 Yaml 文件
接下来,你需要修改 Metrics Server yaml 文件以设置一些配置选项:
```
# vi components.yaml
```
找到 container 下的 args 部分,添加以下行:
```
- --kubelet-insecure-tls
```
在 spec 下,添加以下参数:
```
hostNetwork: true
```
![][2]
保存并关闭文件。
### 步骤 3部署指标服务器
现在,我们准备好部署指标服务器,运行以下 kubectl 命令:
```
# kubectl apply -f components.yaml
```
![][3]
### 步骤 4验证指标服务器部署
部署指标服务器后,通过检查在 kube-system 命名空间中运行的 pod 状态来验证它的状态:
```
# kubectl get pods -n kube-system
```
![][4]
上面的输出确认指标服务器 pod 已启动并正在运行。
### 步骤 5测试指标服务器安装
最后,你可以通过运行以下 kubectl 命令来测试指标服务器:
```
# kubectl top nodes
```
此命令应显示集群中每个节点的资源利用率,包括 CPU 和内存使用率。
![][5]
要查看当前命名空间或特定命名空间的 pod 资源利用率,请运行:
```
# kubectl top pod
# kubectl top pod -n kube-system
```
![][6]
这就是这篇文章的全部内容,我希望你能从中找到有用的信息。请在下面的评论部分发表你的反馈和疑问。
--------------------------------------------------------------------------------
via: https://www.linuxtechi.com/how-to-install-kubernetes-metrics-server/
作者:[Pradeep Kumar][a]
选题:[lkxed][b]
译者:[geekpi](https://github.com/geekpi)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://www.linuxtechi.com/author/pradeep/
[b]: https://github.com/lkxed/
[1]: https://www.linuxtechi.com/wp-content/uploads/2023/03/Download-Metrics-Server-Yaml-file-Curl-Command-1024x127.png?ezimgfmt=ng:webp/ngcb22
[2]: https://www.linuxtechi.com/wp-content/uploads/2023/03/Edit-Metrics-Server-Yaml-file.png
[3]: https://www.linuxtechi.com/wp-content/uploads/2023/03/Deploy-Metrics-Server-Kubectl-Command.png
[4]: https://www.linuxtechi.com/wp-content/uploads/2023/03/Metrics-Server-Pods-Status-Kube-System.png
[5]: https://www.linuxtechi.com/wp-content/uploads/2023/03/Kubectl-top-node-command-Output.png?ezimgfmt=ng:webp/ngcb22
[6]: https://www.linuxtechi.com/wp-content/uploads/2023/03/Kubectl-top-pod-command-output.png