【亚马逊云科技】使用Helm 3为Amazon EKS部署Prometheus+Grafana监控平台

news/2024/5/18 23:41:03 标签: prometheus, grafana

在这里插入图片描述

文章目录

      • 1. 创建Kubernetes命名空间
      • 2. 添加Prometheus社区helm chart
      • 3. 安装prometheus
      • 4. 检查Prometheus Pod运行状况
      • 5. 检查Prometheus Service部署情况
      • 6. 修改服务访问端口类型
      • 7. 访问Prometheus数据收集情况
      • 8. 访问Grafana
      • 9. 设置数据源
      • 10. 查看Kubernetes各类性能可视化参数信息

1. 创建Kubernetes命名空间

首先,创建一个 Kubernetes 命名空间,并使用 helm 来部署 stable/monitoring 软件包:

$ kubectl create namespace monitoring

操作过程演示:

[ec2-user@ip-172-31-37-104 ~]$ kubectl create namespace monitoring 
namespace/monitoring  created

[ec2-user@ip-172-31-37-104 ~]$ kubectl get ns
NAME              STATUS   AGE
default           Active   153m
kube-node-lease   Active   153m
kube-public       Active   153m
kube-system       Active   153m
monitoring        Active   86m

2. 添加Prometheus社区helm chart

其次,添加 Prometheus 社区helm chart:

$ helm repo add prometheus-community https://prometheus-community.github.io/helm-charts

$ helm repo update

$ helm repo list

$ helm search repo stable/prometheus-operator
$ helm search repo prometheus-operator

操作过程演示:

[ec2-user@ip-172-31-37-104 ~]$ helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
"prometheus-community" already exists with the same configuration, skipping

[ec2-user@ip-172-31-37-104 ~]$ helm repo update
Hang tight while we grab the latest from your chart repositories...
...Successfully got an update from the "grafana" chart repository
...Successfully got an update from the "prometheus-community" chart repository
...Successfully got an update from the "stable" chart repository
Update Complete. ⎈Happy Helming![ec2-user@ip-172-31-37-104 ~]$ helm repo list
NAME                    URL
prometheus-community    https://prometheus-community.github.io/helm-charts
grafana                 https://grafana.github.io/helm-charts
stable                  https://charts.helm.sh/stable

[ec2-user@ip-172-31-37-104 ~]$ helm search repo prometheus-community/prometheus-operator
NAME                            CHART VERSION   APP VERSION     DESCRIPTION
stable/prometheus-operator      9.3.2           0.38.1          DEPRECATED Provides easy monitoring definitions...

prometheus_65">3. 安装prometheus

接着,使用helm install安装prometheus

helm install stable prometheus-community/kube-prometheus-stack --debug

创建过程显示正常,最后会输出如下内容:

NOTES:
kube-prometheus-stack has been installed. Check its status by running:
  kubectl --namespace default get pods -l "release=stable"

Visit https://github.com/prometheus-operator/kube-prometheus for instructions on how to create & configure Alertmanager and Prometheus instances using the Operator.

4. 检查Prometheus Pod运行状况

最后,检查Prometheus Pods的部署情况。

[ec2-user@ip-172-31-37-104 ~]$ kubectl get pods -n monitoring
NAME                                                     READY   STATUS    RESTARTS   AGE
alertmanager-stable-kube-prometheus-sta-alertmanager-0   2/2     Running   0          131m
prometheus-stable-kube-prometheus-sta-prometheus-0       2/2     Running   0          131m
stable-grafana-58b76cd9d7-tgd8r                          3/3     Running   0          131m
stable-kube-prometheus-sta-operator-7699d6bfb8-zx8jn     1/1     Running   0          131m
stable-kube-state-metrics-65f45c47c9-5zmj5               1/1     Running   0          131m
stable-prometheus-node-exporter-2q98d                    1/1     Running   0          126m
stable-prometheus-node-exporter-98cf4                    1/1     Running   0          131m
stable-prometheus-node-exporter-d6jnm                    1/1     Running   0          128m
stable-prometheus-node-exporter-gp5dh                    1/1     Running   0          131m
stable-prometheus-node-exporter-gqqls                    1/1     Running   0          128m
stable-prometheus-node-exporter-sqg6x                    1/1     Running   0          126m
[ec2-user@ip-172-31-37-104 ~]$

5. 检查Prometheus Service部署情况

检查部署完成的服务 kubectl get svc

$ kubectl get svc -n monitoring

检查部署完成的Prometheus Pods可以看到每个节点都运行了 node-exporter 且已经运行起 Prometheus和Grafana

[ec2-user@ip-172-31-37-104 ~]$ kubectl get svc -n monitoring
NAME                                      TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)                         AGE
alertmanager-operated                     ClusterIP   None             <none>        9093/TCP,9094/TCP,9094/UDP      79m
prometheus-operated                       ClusterIP   None             <none>        9090/TCP                        79m
stable-grafana                            NodePort    10.100.215.171   <none>        80:32311/TCP                    79m
stable-kube-prometheus-sta-alertmanager   ClusterIP   10.100.237.236   <none>        9093/TCP,8080/TCP               79m
stable-kube-prometheus-sta-operator       ClusterIP   10.100.79.75     <none>        443/TCP                         79m
stable-kube-prometheus-sta-prometheus     NodePort    10.100.141.226   <none>        9090:31634/TCP,8080:31429/TCP   79m
stable-kube-state-metrics                 ClusterIP   10.100.222.140   <none>        8080/TCP                        79m
stable-prometheus-node-exporter           ClusterIP   10.100.168.39    <none>        9100/TCP                        79m

6. 修改服务访问端口类型

🛑情况说明:默认情况下, prometheusgrafana 服务都是使用ClusterIP在集群内部,所以要能够在外部访问,需要使用 NodePort


✅操作内容:修改 stable-kube-prometheus-sta-prometheus 服务和 stable-grafana 服务配置文件中的内容,将 typeClusterIP 修改为 NodePort

$ kubectl edit svc stable-grafana

image-20230712125628700

$ kubectl edit svc stable-kube-prometheus-sta-prometheus

image-20230712125646789

执行kubectl get svc -n monitoring命令,查看对应服务访问的外置端口。

image-20230712130129183

注意:检查对应的主机安全组的端口是否开启。

7. 访问Prometheus数据收集情况

访问Prometheus数据收集情况。其中一个集群工作节点的IP地址+prometheus端口。

image-20230712130643481

8. 访问Grafana

访问Grafana。对Amazon EKS中的数据进行数据可观测性查看。其中一个集群工作节点的IP地址+grafana端口。


访问 Grafana 面板,初始账号 admin 密码是 prom-operator ,请立即修改

image-20230712141136331

9. 设置数据源

1、设置名称。设置为默认数据源


2、Prometheus server URL:Prometheus的SVC对应的Cluster-IP

image-20230712140937751

  • 点击“Save & test”保存并测试。输出结果如下所示,表示成功。

image-20230712141241463

10. 查看Kubernetes各类性能可视化参数信息

  • 查看Kubernetes网络工作负载

image-20230712141018536

  • 查看Kubernetes Pod网络传输情况

image-20230712141045398

  • 查看Kubernetes 服务器接口

image-20230712141056844

  • 查看需要Kubelet命令查询操作的数据

image-20230712141108990

  • 查看Kubernetes Proxy

image-20230712141255088

  • 全局查看Prometheus

image-20230712141310421

  • 查看集群工作节点的系统配置参数信息

image-20230712141338782

image-20230712141348105
在这里插入图片描述
在这里插入图片描述


http://www.niftyadmin.cn/n/5308253.html

相关文章

组合数据(Python实现)

一、主要目的&#xff1a; 1&#xff0e;熟悉组合数据的类型。 2&#xff0e;掌握列表、元组、字典、集合等组合数据的创建、访问方法。 3&#xff0e;掌握组合数据推导式的使用方法 4&#xff0e;熟悉组合数据的常见应用。 二、主要内容和结果展示&#xff1a; 1. 使用两…

SpringDoc注解解析

一、什么是SpringDoc SpringDoc注解的使用&#xff0c;它是基于OpenAPI 3和Swagger 3的现代化解决方案&#xff0c;相较于旧版的Swagger2(SpringFox)&#xff0c;SpringDoc提供了更简洁、更直观的注解方式。 二、SpringDoc的注解分类 2.1 作用于类的注解 1. Tag 用于说明…

【开源】基于JAVA语言的服装店库存管理系统

目录 一、摘要1.1 项目介绍1.2 项目录屏 二、功能模块2.1 数据中心模块2.2 角色管理模块2.3 服装档案模块2.4 服装入库模块2.5 服装出库模块 三、系统设计3.1 用例设计3.2 数据库设计3.2.1 角色表3.2.2 服装档案表3.2.3 服装入库表3.2.4 服装出库表 四、系统展示五、核心代码5.…

c#调试程序一次启动两个工程(多个工程)

概述 c# - Visual Studio : debug multiple projects at the same time? 以在解决方案中设置多个启动项目(右键单击解决方案&#xff0c;转到设置启动项目&#xff0c;选择多个启动项目)&#xff0c;并为包含在解决方案(无、开始、不调试就开始)。如果您将多个项目设置为开始…

FineBI:简介

1 介绍 FineBI 是帆软软件有限公司推出的一款商业智能&#xff08;Business Intelligence&#xff09;产品。 FineBI 是定位于自助大数据分析的 BI 工具&#xff0c;能够帮助企业的业务人员和数据分析师&#xff0c;开展以问题导向的探索式分析。 2 现阶段数据分析弊端 现阶…

Vue-2、初识Vue

1、helloword小案列 代码 <!DOCTYPE html> <html lang"en"> <head><meta charset"UTF-8"><title>初始Vue</title><!--引入vue--><script type"text/javascript" src"https://cdn.jsdelivr.n…

keil 5 ARM CC编译错误和警告解释大全(3)序列号2000-3000

2001年&#xff1a;已声明虚拟参数&#xff0c;但从未使用过 2002年&#xff1a;虚拟参数重新定义为do变量 2003&#xff1a;无法优化&#xff1a;常量/表达式传递给可能修改的变量 2004&#xff1a;重新维度的数组作为参数传递 2005&#xff1a;重维度数组等价 2006&…

JDBC*

*JDBC数据库连接步骤 1.将JDBC驱动的jar添加到项目的依赖中。 2.加载JDBC驱动 例如&#xff1a; Class.forName("com.mysql.jdbc.Driver"); 3.连接数据库 例如&#xff1a; Connection con DriverManager.getConnection(URL,us…