Helm 安装 Grafana Prometheus Altermanager 套件
安装helm
代码语言:shell复制# 安装helm工具
curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3
chmod 700 get_helm.sh
./get_helm.sh
下载离线包
代码语言:shell复制# 添加 prometheus-community 官方Helm Chart仓库
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
# 下载离线包
helm pull prometheus-community/kube-prometheus-stack
# 解压下载下来的包
tar xvf kube-prometheus-stack-45.1.0.tgz
修改镜像地址
代码语言:shell复制# 进入目录进行修改images地址
cd kube-prometheus-stack/
sed -i "s#registry.k8s.io/kube-state-metrics/kube-state-metrics#registry.cn-hangzhou.aliyuncs.com/chenby/kube-state-metrics#g" charts/kube-state-metrics/values.yaml
# 修改为如下
vim values.yaml
···
image:
registry: registry.cn-hangzhou.aliyuncs.com
repository: chenby/kube-webhook-certgen
···
安装
代码语言:shell复制# 进行安装
helm install op .
WARNING: Kubernetes configuration file is group-readable. This is insecure. Location: /root/.kube/config
WARNING: Kubernetes configuration file is world-readable. This is insecure. Location: /root/.kube/config
NAME: op
LAST DEPLOYED: Wed Feb 15 17:28:47 2023
NAMESPACE: default
STATUS: deployed
REVISION: 1
NOTES:
kube-prometheus-stack has been installed. Check its status by running:
kubectl --namespace default get pods -l "release=op"
Visit https://github.com/prometheus-operator/kube-prometheus for instructions on how to create & configure Alertmanager and Prometheus instances using the Operator.
修改 svc
代码语言:shell复制# 修改 svc 将其设置为NodePort
kubectl edit svc op-grafana
kubectl edit svc op-kube-prometheus-stack-prometheus
type: NodePort
查看
代码语言:shell复制root@hello:~# kubectl --namespace default get pods -l "release=op"
NAME READY STATUS RESTARTS AGE
op-kube-prometheus-stack-operator-bf67f6dbc-dsqgq 1/1 Running 0 12m
op-kube-state-metrics-d94c76d4f-r9nkg 1/1 Running 0 12m
op-prometheus-node-exporter-2hlmc 1/1 Running 0 12m
op-prometheus-node-exporter-8trpl 1/1 Running 0 12m
op-prometheus-node-exporter-j2lns 1/1 Running 0 12m
op-prometheus-node-exporter-j4l69 1/1 Running 0 12m
op-prometheus-node-exporter-krw2v 1/1 Running 0 12m
root@hello:~#
# 查看svc
root@hello:~# kubectl --namespace default get svc | grep op
alertmanager-operated ClusterIP None <none> 9093/TCP,9094/TCP,9094/UDP 12m
op-grafana NodePort 10.102.25.207 <none> 80:32174/TCP 12m
op-kube-prometheus-stack-alertmanager ClusterIP 10.102.32.128 <none> 9093/TCP 12m
op-kube-prometheus-stack-operator ClusterIP 10.109.56.209 <none> 443/TCP 12m
op-kube-prometheus-stack-prometheus NodePort 10.101.74.136 <none> 9090:30777/TCP 12m
op-kube-state-metrics ClusterIP 10.99.39.208 <none> 8080/TCP 12m
op-prometheus-node-exporter ClusterIP 10.99.213.34 <none> 9100/TCP 12m
prometheus-operated ClusterIP None <none> 9090/TCP 12m
root@hello:~#
# 查看POD
root@hello:~# kubectl --namespace default get pod | grep op
alertmanager-op-kube-prometheus-stack-alertmanager-0 2/2 Running 1 (13m ago) 13m
op-grafana-5cd75cfd86-4df7g 3/3 Running 0 13m
op-kube-prometheus-stack-operator-bf67f6dbc-dsqgq 1/1 Running 0 13m
op-kube-state-metrics-d94c76d4f-r9nkg 1/1 Running 0 13m
op-prometheus-node-exporter-2hlmc 1/1 Running 0 13m
op-prometheus-node-exporter-8trpl 1/1 Running 0 13m
op-prometheus-node-exporter-j2lns 1/1 Running 0 13m
op-prometheus-node-exporter-j4l69 1/1 Running 0 13m
op-prometheus-node-exporter-krw2v 1/1 Running 0 13m
prometheus-op-kube-prometheus-stack-prometheus-0 2/2 Running 0 13m
root@hello:~#
访问
代码语言:shell复制# 访问
http://192.168.1.61:30777
http://192.168.1.61:32174
关于
https://www.oiox.cn/
https://www.oiox.cn/index.php/start-page.html
CSDN、GitHub、51CTO、知乎、开源中国、思否、掘金、简书、华为云、阿里云、腾讯云、哔哩哔哩、今日头条、新浪微博、个人博客
全网可搜《小陈运维》
文章主要发布于微信公众号