K8S上使用helm部署 Prometheus + Grafana

article/2025/6/7 21:55:16
一、使用 Helm 安装 Prometheus
1. 配置源

  地址:prometheus 27.19.0 · prometheus/prometheus-community

# 添加repo
$ helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
"prometheus-community" has been added to your repositories$ helm repo update prometheus-community
Hang tight while we grab the latest from your chart repositories...
...Successfully got an update from the "prometheus-community" chart repository
Update Complete. ⎈Happy Helming!⎈$ helm search repo prometheus-community
NAME                                                    CHART VERSION   APP VERSION     DESCRIPTION                                       
prometheus-community/alertmanager                       1.19.0          v0.28.1         The Alertmanager handles alerts sent by client ...
prometheus-community/alertmanager-snmp-notifier         1.0.0           v2.0.0          The SNMP Notifier handles alerts coming from Pr...
prometheus-community/jiralert                           1.7.2           v1.3.0          A Helm chart for Kubernetes to install jiralert   
prometheus-community/kube-prometheus-stack              72.7.0          v0.82.2         kube-prometheus-stack collects Kubernetes manif...
prometheus-community/kube-state-metrics                 5.33.2          2.15.0          Install kube-state-metrics to generate and expo...
prometheus-community/prom-label-proxy                   0.12.2          v0.11.0         A proxy that enforces a given label in a given ...
prometheus-community/prometheus                         27.16.0         v3.4.0          Prometheus is a monitoring system and time seri...
prometheus-community/prometheus-adapter                 4.14.1          v0.12.0         A Helm chart for k8s prometheus adapter           
prometheus-community/prometheus-blackbox-exporter       9.7.0           v0.26.0         Prometheus Blackbox Exporter                      
prometheus-community/prometheus-cloudwatch-expo...      0.27.0          0.16.0          A Helm chart for prometheus cloudwatch-exporter   
prometheus-community/prometheus-conntrack-stats...      0.5.19          v0.4.27         A Helm chart for conntrack-stats-exporter         

2. 下载 prometheus 包

# 拉包
$ helm pull prometheus-community/prometheus$ ll
total 88
drwxr-xr-x 2 root   root    4096 Jul 16 03:12 ./
drwxrwxr-x 9 ubuntu ubuntu  4096 Jul 16 03:10 ../
-rw-r--r-- 1 root   root   80137 Jul 16 03:12 prometheus-27.16.0.tgz# 解包
$ tar -zxvf prometheus-27.16.0.tgz ###修改存储,需修改2处
vim values.yaml## Prometheus server data Persistent Volume Storage Class## If defined, storageClassName: <storageClass>## If set to "-", storageClassName: "", which disables dynamic provisioning## If undefined (the default) or set to null, no storageClassName spec is##   set, choosing the default provisioner.  (gp2 on AWS, standard on##   GKE, AWS & OpenStack)##storageClass: "managed-nfs-storage"  ###修改为自己的动态存储名称## Subdirectory of Prometheus server data Persistent Volume to mount## Useful if the volume's root directory is not empty##subPath: ""vim charts/alertmanager/values.yaml persistence:enabled: true## Persistent Volume Storage Class## If defined, storageClassName: <storageClass>## If set to "-", storageClassName: "", which disables dynamic provisioning## If undefined (the default) or set to null, no storageClassName spec is## set, choosing the default provisioner.##storageClass: "managed-nfs-storage" ###修改为自己的动态存储名称accessModes:- ReadWriteOncesize: 50Mi#####部署helm install prometheus ./ -n prometheus
二、使用 Helm 安装 Grafana
1. 配置源

  地址:grafana 9.2.2 · grafana/grafana

$ helm repo add grafana https://grafana.github.io/helm-charts
"grafana" has been added to your repositories$ helm repo update grafana
Hang tight while we grab the latest from your chart repositories...
...Successfully got an update from the "grafana" chart repository
Update Complete. ⎈Happy Helming!⎈$ helm search repo grafana/grafana
NAME                            CHART VERSION   APP VERSION     DESCRIPTION                                       
grafana/grafana                 9.2.2           12.0.1          The leading tool for querying and visualizing t...
grafana/grafana-agent           0.42.0          v0.42.0         Grafana Agent                                     
grafana/grafana-agent-operator  0.5.1           0.44.2          A Helm chart for Grafana Agent Operator           
grafana/grafana-operator        v5.18.0         v5.18.0         Helm chart for the Grafana Operator               
grafana/grafana-sampling        1.1.5           v1.7.5          A Helm chart for a layered OTLP tail sampling a...

 2. 安装 grafana

$  helm install grafana grafana/grafana -n grafana --create-namespace
NAME: grafana
LAST DEPLOYED: Tue Jun  3 13:51:47 2025
NAMESPACE: grafana
STATUS: deployed
REVISION: 1
NOTES:
1. Get your 'admin' user password by running:kubectl get secret --namespace grafana grafana -o jsonpath="{.data.admin-password}" | base64 --decode ; echo2. The Grafana server can be accessed via port 80 on the following DNS name from within your cluster:grafana.grafana.svc.cluster.localGet the Grafana URL to visit by running these commands in the same shell:export POD_NAME=$(kubectl get pods --namespace grafana -l "app.kubernetes.io/name=grafana,app.kubernetes.io/instance=grafana" -o jsonpath="{.items[0].metadata.name}")kubectl --namespace grafana port-forward $POD_NAME 30003. Login with the password from step 1 and the username: admin
#################################################################################
######   WARNING: Persistence is disabled!!! You will lose your data when   #####
######            the Grafana pod is terminated.                            #####
#################################################################################

 3. 访问

web 访问:https://yourip:port

账号:admin,密码通过下面命令获取

$ kubectl get secret --namespace grafana grafana -o jsonpath="{.data.admin-password}" | base64 --decode ; echo
0D0NfEWWFx9qsBiKR8PuFVxf6PPa9o8YGhZZaNXY


http://www.hkcw.cn/article/feyuSDtwPp.shtml

相关文章

湖北理元理律师事务所:系统性债务化解中的法律技术革新

一、打破债务困局的核心&#xff1a;精准责任切割 传统债务处理常陷入"全额偿还"或"逃废债"的二元对立。法律视角下的解决方案在于&#xff1a; 通过法定程序分离三类债务&#xff1a; 无效债务&#xff1a;年利率超LPR四倍部分&#xff08;《民法典》第…

Android Studio 向模拟器手机添加照片、视频、音乐

Android Studio 向模拟器手机添加照片、视频、音乐(其实都是一样的&#xff0c;只是添加到不同的文件夹&#xff09;&#xff0c;例如我们在很多程序中功能例如&#xff1a;选择头像&#xff0c;跳转到手机相册选择头像&#xff0c;此时相册为空&#xff0c;即模拟器没有图片资…

vscode使用“EIDE”和“Cortex-Debug”插件利用st-link插件实现程序烧写以及调试工作

第一步&#xff1a;安装vscode插件“EIDE”EIDE和“Cortex-Debug”。 第二步&#xff1a;配置EIDE 2.1安装“实用工具”&#xff1a; 2.2 EIDE插件配置&#xff1a;根据安装的keil C51 keil MDK IAR的相关路径设置 第三步&#xff1a;配置Cortex-Debug插件 点击settings.jso…

详解开漏输出和推挽输出

开漏输出和推挽输出 以上是 GPIO 配置为输出时的内部示意图&#xff0c;我们要关注的其实就是这两个 MOS 管的开关状态&#xff0c;可以组合出四种状态&#xff1a; 两个 MOS 管都关闭时&#xff0c;输出处于一个浮空状态&#xff0c;此时他对其他点的电阻是无穷大的&#xff…

问界M9五座零重力座椅版实车亮相 智慧出行新体验

5月31日,2025粤港澳大湾区国际汽车博览会正式开幕,问界携全系车型亮相,并举办了“问界M9大五座零重力座椅版交付仪式暨品牌挚友发布会”。赛力斯汽车总裁何利扬向五位车主交付了问界M9 2025款大五座零重力座椅版的钥匙,并宣布演员白敬亭成为问界品牌挚友及问界M8车主。何利…

【Linux】线程互斥

&#x1f4dd;前言&#xff1a; 这篇文章我们来讲讲Linux——线程互斥 &#x1f3ac;个人简介&#xff1a;努力学习ing &#x1f4cb;个人专栏&#xff1a;Linux &#x1f380;CSDN主页 愚润求学 &#x1f304;其他专栏&#xff1a;C学习笔记&#xff0c;C语言入门基础&#xf…

「OC」初识runloop

「OC」初识runloop 简介 iOS中的RunLoop&#xff08;运行循环&#xff09;是事件处理的核心机制&#xff0c;负责管理线程的生命周期、事件调度及资源优化。其核心作用是通过循环处理输入事件、定时器任务和观察者回调&#xff0c;保持线程活跃且高效运行。 runloop的作用 R…

python学习打卡day43

DAY 43 复习日 作业&#xff1a; kaggle找到一个图像数据集&#xff0c;用cnn网络进行训练并且用grad-cam做可视化 浙大疏锦行 数据集使用猫狗数据集&#xff0c;训练集中包含猫图像4000张、狗图像4005张。测试集包含猫图像1012张&#xff0c;狗图像1013张。以下是数据集的下…

【AI学习从零至壹】基于深度学习的⽂本分类任务

基于深度学习的⽂本分类任务 文本分类任务的实现思路⽂本预处理文本分词Jieba分词文本分词器SentencePiece训练步骤⽂本结构化转换 语料转换为训练样本 文本分类任务的实现思路 ⽂本分类就是⼀个将⽂本分配到预定义类别的⼀个过程 整体流程包括&#xff1a; ⽂本语料的获取和…

sourcetree中的mercurial有什么用

1、安装SourceTree的过程中&#xff0c;有一个选项就是mercurial&#xff0c;&#xff0c;一直没搞明白他是干什么用的&#xff0c;直到今天 2、ai登场 3、总结 此软件无用&#xff0c;不需要安装

【Linux】linux基础指令

目录 管理用户相关useraddpaaswduserdelLinux中的用户文件结构 ls-aLinux目录中的.和..是什么&#xff1f; -l-d-FLinux指令使用多个选项 pwdcd绝对路径与相对路径 touchmkdir-p rmdir-p rm-r-i-f mancpmvecho输出重定向和追加重定向 cat-b-n-s moreless-N-i headtail管道文件搭…

Linux中shell介绍

一、脚本实践 脚本示例1 -- 直接编辑并创建一个文件 vim bak.sh-- 写入下面这句话 # 获取ip地址信息 ifconfig ens33 | grep -w inet | awk {print $2} | xargs echo "IP: "-- 运行bak文件 bash bak.sh或者-- 添加可执行权限 chmod ax bak.sh./bak.sh或者source ba…

【智能制造】精读57页智慧工厂MES 项目解决方案【附全文阅读】

本文概述了智慧工厂MES项目解决方案在工业4.0背景下的整体框架与应用。智慧工厂以企业管理运营中心为核心&#xff0c;融合战略绩效、集团管控、决策分析及大数据分析平台&#xff0c;实现C2M&#xff08;Consumer to Manufacturer&#xff09;个性化订单处理。通过信息化系统平…

Stable Diffusion 技术原理解析与代码实践

1. 引言 Stable Diffusion 是由 Stability AI 开发的开源文本到图像生成模型,自 2022 年发布以来在创意产业和研究领域引起了广泛关注。它基于潜在扩散模型架构,能够根据文本描述生成高质量的图像内容,为艺术创作、设计和内容生成提供了强大工具。 2. 技术原理详解 2.1 扩…

Cursor + Claude 4:海外工具网站开发变现实战案例

项目背景 在全球数字化浪潮中&#xff0c;海外工具网站市场蕴含着巨大的商业机会。本文将详细介绍如何使用Cursor编辑器结合Claude 4 AI助手&#xff0c;开发一个面向海外用户的多功能工具网站"ToolBox Pro"&#xff0c;并通过多元化策略实现有效变现。该项目在6个月…

AI 赋能名片设计:告别模板化,创造独特视觉风格

在商务社交与个人品牌传播中&#xff0c;名片是传递信息的重要载体&#xff0c;但千篇一律的模板设计往往让印象大打折扣。智能设计工具的出现&#xff0c;正以智能排版、创意生成和高效迭代的优势&#xff0c;颠覆传统名片设计范式。本文将推荐创客贴、Canva、Fotor 懒设计等多…

MCP:让AI工具协作变得像聊天一样简单 [特殊字符]

想象一下,你正在处理一个项目,需要从A平台查看团队讨论,从B平台获取客户信息,还要在GitHub上检查代码进度。传统做法是什么?打开三个不同的网页,在各个平台间来回切换,复制粘贴数据,最后还可能因为信息分散而遗漏重要细节。 听起来很熟悉?这正是当前工作流程的痛点所…

h5的aliplayer-min.js 加密视频会走到debugger

h5的aliplayer-min.js 如果 https://g.alicdn.com/apsara-media-box/imp-web-player/2.19.0/aliplayer-min.js走加密视频的话会有debugger 更换aliplayer-min.js版本解决了 https://g.alicdn.com/apsara-media-box/imp-web-player/2.25.1/aliplayer-min.js 对应css&#xff1a…

AgenticSeek:您的本地AI智能大脑,免费且私密

还在为昂贵的AI智能体订阅费望而却步吗&#xff1f;还在担心将敏感数据交由第三方处理的隐私风险吗&#xff1f;现在&#xff0c;一款名为AgenticSeek的AI工具横空出世&#xff0c;它承诺提供一个完全免费、100%本地化运行、且功能强大的AI智能体解决方案&#xff0c;旨在成为付…

活动选择问题一文详解

活动选择问题一文详解 一、活动选择问题描述1.1 问题定义1.2 示例说明 二、贪心算法求解策略2.1 贪心思想2.2 策略证明2.3 算法步骤 三、代码实现3.1 Python 实现3.2 C 实现3.3 Java 实现 四、复杂度分析4.1 时间复杂度4.2 空间复杂度 五、应用拓展5.1 资源分配5.2 任务调度优化…