热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

k8s部署Prometheus

Prometheus(普罗米修斯)是一套开源的监控系统.由SoundCloud公司开发。

Prometheus(普罗米修斯)是一套开源的监控系统.由SoundCloud公司开发。Docker、Mesos、Kubernetes环境常用Prometheus来监控,下图为Prometheus的架构图


k8s部署好后,就可以进行Prometheus部署,这里采用k8s进行部署

以下均在master节点执行

一  安装好git后,执行git clone

git clone https://github.com/coreos/kube-prometheus.git


二 由于各种原因,我们从阿里云上下载镜像,并重新tag,以下master,worker节点均执行


docker pull registry.cn-hangzhou.aliyuncs.com/loong576/configmap-reload:v0.0.1

 docker pull registry.cn-hangzhou.aliyuncs.com/loong576/alertmanager:v0.18.0

 docker pull registry.cn-hangzhou.aliyuncs.com/loong576/kube-state-metrics:v1.8.0

 docker pull registry.cn-hangzhou.aliyuncs.com/loong576/kube-rbac-proxy:v0.4.1

 docker pull registry.cn-hangzhou.aliyuncs.com/loong576/node-exporter:v0.18.1

 docker pull registry.cn-hangzhou.aliyuncs.com/loong576/k8s-prometheus-adapter-amd64:v0.5.0

 docker pull registry.cn-hangzhou.aliyuncs.com/loong576/prometheus-config-reloader:v0.33.0

 docker pull registry.cn-hangzhou.aliyuncs.com/loong576/prometheus:v2.11.0

 docker pull registry.cn-hangzhou.aliyuncs.com/loong576/prometheus-operator:v0.33.0

 docker pull registry.cn-hangzhou.aliyuncs.com/loong576/grafana:6.4.3


 docker tag  registry.cn-hangzhou.aliyuncs.com/loong576/configmap-reload:v0.0.1 quay.io/coreos/configmap-reload:v0.0.1

 docker tag registry.cn-hangzhou.aliyuncs.com/loong576/alertmanager:v0.18.0 quay.io/prometheus/alertmanager:v0.18.0

 docker tag registry.cn-hangzhou.aliyuncs.com/loong576/kube-state-metrics:v1.8.0 quay.io/coreos/kube-state-metrics:v1.8.0

 docker tag registry.cn-hangzhou.aliyuncs.com/loong576/kube-rbac-proxy:v0.4.1 quay.io/coreos/kube-rbac-proxy:v0.4.1

 docker tag registry.cn-hangzhou.aliyuncs.com/loong576/node-exporter:v0.18.1  quay.io/prometheus/node-exporter:v0.18.1

 docker tag  registry.cn-hangzhou.aliyuncs.com/loong576/k8s-prometheus-adapter-amd64:v0.5.0 quay.io/coreos/k8s-prometheus-adapter-amd64:v0.5.0

 docker tag  registry.cn-hangzhou.aliyuncs.com/loong576/prometheus-config-reloader:v0.33.0 quay.io/coreos/prometheus-config-reloader:v0.33.0

 docker tag registry.cn-hangzhou.aliyuncs.com/loong576/prometheus:v2.11.0 quay.io/prometheus/prometheus:v2.11.0

 docker tag registry.cn-hangzhou.aliyuncs.com/loong576/prometheus-operator:v0.33.0  quay.io/coreos/prometheus-operator:v0.33.0

 docker tag registry.cn-hangzhou.aliyuncs.com/loong576/grafana:6.4.3 grafana/grafana:6.4.3


 docker rmi -f  registry.cn-hangzhou.aliyuncs.com/loong576/configmap-reload:v0.0.1

 docker rmi -f registry.cn-hangzhou.aliyuncs.com/loong576/alertmanager:v0.18.0

 docker  rmi -f  registry.cn-hangzhou.aliyuncs.com/loong576/kube-state-metrics:v1.8.0

 docker  rmi -f  registry.cn-hangzhou.aliyuncs.com/loong576/kube-rbac-proxy:v0.4.1

 docker  rmi -f  registry.cn-hangzhou.aliyuncs.com/loong576/node-exporter:v0.18.1

 docker  rmi -f  registry.cn-hangzhou.aliyuncs.com/loong576/k8s-prometheus-adapter-amd64:v0.5.0

 docker  rmi -f  registry.cn-hangzhou.aliyuncs.com/loong576/prometheus-config-reloader:v0.33.0

 docker  rmi -f  registry.cn-hangzhou.aliyuncs.com/loong576/prometheus:v2.11.0

 docker  rmi -f  registry.cn-hangzhou.aliyuncs.com/loong576/prometheus-operator:v0.33.0

 docker  rmi -f  registry.cn-hangzhou.aliyuncs.com/loong576/grafana:6.4.3



三,在master 上创建pod


kubectl create -f manifests/setup

kubectl create -f manifests/

 kubectl get all -n monitoring

 


四,配置外部访问


 kubectl edit -n monitoring service prometheus-k8s

kubectl edit -n monitoring service grafana

 kubectl edit -n monitoring service alertmanager-main

三个配置文件中要修改下面的端口和类型 

nodePort: 10021   

 type: NodePort


 kubectl get svc -n monitoring进行验证


四 访问web

 

访问 Prometheus  http://master:10021

访问 Grafana   http://master:10022  需要数据源绑定

访问 Alert Manager  http://master:10022


kuPrometheus 卸载

bectl delete --ignore-not-found=true -f manifests/ -f manifests/setup



推荐阅读
author-avatar
拍友2602932873
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有