当前位置: 首页 > news >正文

K8S上采用helm部署 Prometheus + Grafana

一、使用 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-communityHang tight while we grab the latest from your chart repositories......Successfully got an update from the "prometheus-community" chart repositoryUpdate Complete. ⎈Happy Helming!⎈ $ helm search repo prometheus-communityNAME                                                    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 $ lltotal 88drwxr-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:     ## 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:   ## 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:    - ReadWriteOnce  size: 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 grafanaHang tight while we grab the latest from your chart repositories......Successfully got an update from the "grafana" chart repositoryUpdate Complete. ⎈Happy Helming!⎈ $ helm search repo grafana/grafanaNAME                            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-namespaceNAME: grafanaLAST DEPLOYED: Tue Jun  3 13:51:47 2025NAMESPACE: grafanaSTATUS: deployedREVISION: 1NOTES:1. Get your 'admin' user password by running:    kubectl get secret --namespace grafana grafana -o jsonpath="{.data.admin-password}" | base64 --decode ; echo  2. The Grafana server can be accessed via port 80 on the following DNS name from within your cluster:    grafana.grafana.svc.cluster.local    Get 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 3000 3. 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 ; echo0D0NfEWWFx9qsBiKR8PuFVxf6PPa9o8YGhZZaNXY

http://www.sczhlp.com/news/172297/

相关文章:

  • AI元人文的硅基基石体系:EPU+VPU+WBUC+WAUC深度解析——声明Ai解析
  • 紧固件做网站有效果吗建设英文网站费用
  • 做网站组织结构框架例子公司网站主页怎么做
  • cod建站平台做seo网站公司
  • 域名买了怎么做网站网站公司怎么做
  • 南山做网站行业怎么给新公司做网站
  • 上海频道网站建设企业级建站
  • 触摸屏html网站东莞阳光网
  • 天津网站建设软件开发招聘社交网络的推广方法
  • 北镇网站建设重庆农村网站建设
  • 韩国设计app网站有哪些成都那家网站制作公司好
  • 中山做网站的北京网页设计公司网站
  • 茶楼网站西安是哪个省的城市
  • 学网站开发的软件花园之家wordpress
  • 一起做网店潮汕站成都市建设网站公司
  • 发布网站后备案万江做网站的公司
  • 微网站可以自己做吗怎样查看网站是否备案
  • 如何在百度做网站自己建立旅游的网站建设
  • 网站建设推广是什么工作室静安做网站公司
  • 西安seo和网络推广重庆seo技术教程博客
  • 在茂名哪里可以做网站网站建立公司 优帮云
  • 怎么让自己的网站通过域名访问用手机做网站的软件
  • 网站不备案不能用吗网页设计图片大小怎么调
  • 网站建设开发做网站吧建设一个旅游电子商务网站
  • 钦州做网站自己买域名可以做网站吗
  • 做网站是咋收费的微商城和小程序商城有什么区别?
  • 高频感应钎焊在制冷行业的应用与优势:高效、绿色、智能的焊接革命!
  • 题解:P12672 「LAOI-8」近期我们注意到有网站混淆视听
  • 详细介绍:基于LangChain构建高效RAG问答系统:向量检索与LLM集成实战
  • 网关配置