kubernetes prometheus 系列| helm 部署prometheus+grafana

发布于:2024-08-02 ⋅ 阅读:(80) ⋅ 点赞:(0)

一、环境准备

部署k8s集群
k8sv1.26直通车搭建
安装存储类
nfs动态供给直通车
安装helm工具
https://github.com/helm/helm/releases

tar -zxvf helm-v3.5.4-linux-amd64.tar.gz
sudo mv linux-amd64/helm /usr/local/bin/helm
chmod o+x /usr/local/bin/helm
helm version

二、部署kube-prometheus-stack

Helm Chart信息
名称: kube-prometheus-stack
仓库: prometheus-community
查找命令:

helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
helm search repo prometheus-community/kube-prometheus-stack

下载到本地:helm fetch prometheus-community/kube-prometheus-stack

helm upgrade --install kube-prometheus-stack kube-prometheus-stack \
  -n monitoring --create-namespace

说明:
–install: 如果不存在,则安装 Helm chart。
kube-prometheus-stack: Helm chart 的名称和发布名称。
-n monitoring: 在名为 “monitoring” 的命名空间中执行操作。
–create-namespace: 如果命名空间不存在,则创建。
在这里插入图片描述
暴露grafana端口

[root@k8s-master ~]# cat grafanasvc.yaml 
apiVersion: v1
kind: Service
metadata:
  name: prometheus-grafana-nodeport
  namespace: monitoring
spec:
  internalTrafficPolicy: Cluster
  ports:
  - name: http-web
    port: 80
    protocol: TCP
    targetPort: 3000
    nodePort: 30081
  selector:
    app.kubernetes.io/instance: kube-prometheus-stack
    app.kubernetes.io/name: grafana
  sessionAffinity: None
  type: NodePort

使用node IP加端口访问登录。

用户名: admin
密码: prom-operator

AlertManager实现企业微信报警直通车

持续更新中,关注不迷糊…