如遇图片无法加载请使用代理访问
前言
本文主要讲述 2023 K3s Rancher 部署 Prometheus + Grafana
如果你还没有部署 K3s 和 Rancher ,你可以浏览这篇文章:【K3S】01 - 异地集群初始化
环境声明
hostname | 系统 | 配置 | 节点 | 角色 | 部署 |
---|---|---|---|---|---|
m1 | Ubuntu-Server(20.04) | 2c4g | 192.168.0.67/32 | control-plane,etcd,master | k3s(v1.24.6+k3n1) server nginx rancher(2.7.1) Helm(3.10.3) |
n1 | Ubuntu-Server(20.04) | 1c2g | 192.168.0.102/32 | control-plane,etcd,master | k3s(v1.24.6+k3n1) server |
m2 | Ubuntu-Server(20.04) | 2c4g | 172.25.4.244/32 | control-plane,etcd,master | k3s(v1.24.6+k3n1) server |
harbor | Ubuntu-Server(20.04) | 2c4g | 192.168.0.88 | Docker-Hub Jenkins CI/CD |
Harbor(2.7.1) Jenkins(2.3) Docker-Compose |
节点均用 WireGuard 打通内网,后续所有节点路由均用内网ip访问
安装
首先添加Prometheus的仓库地址
1 | helm repo add prometheus-community https://prometheus-community.github.io/helm-charts |
拉取离线包
我们拉取了指定版本的离线包
1 | helm pull prometheus-community/kube-prometheus-stack --version 45.1.0 |
解压离线包
1 | tar xvf kube-prometheus-stack-* |
修改镜像地址为国内源
1 | cd kube-prometheus-stack/ |
安装
1 | kubectl create ns monitor |
修改 op-grafana
的类型为 NodePort
1 | kubectl edit svc op-grafana -n monitor |
修改 op-kube-prometheus-stack-prometheus
的类型为 NodePort
1 | kubectl edit svc op-kube-prometheus-stack-prometheus -n monitor |
查看安装结果
1 | kubectl --namespace monitor get pods -l "release=op" |
访问 任意节点ip:NodePort
即可
Grafana 的默认用户名为 admin
,密码为prom-operator
1 | root@m1:/yaml/kube-prometheus-stack# kubectl --namespace monitor get svc | grep op |
参考文章
本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 Leopold's Blog!
评论
DisqusjsGitalk