hincky的主页 hincky的主页
  • 学习笔记

    • Vue笔记
    • Vuepress
    • nginx
  • 语言类

    • java
    • go
    • python
    • 设计模式
  • 框架类

    • Spring
    • Spring Security
    • Mybatis
  • 容器技术

    • docker
    • k8s
    • helm
    • prometheus
    • grafana
    • jenkins
  • 命令集合

    • linux命令
    • docker命令
    • git命令
    • vim命令
    • k8s命令
  • 数据库

    • sql
    • mysql
  • 协议

    • 网络模型
    • http/1.1
    • WebSocket
    • http/2
    • TLS/SSL
    • tcp
    • IP
    • tcpdump抓包命令
    • wireshark抓包工具
  • 通用

    • Git
  • 技术分享

    • git push/pull总是超时怎么办
    • idea debug技巧
    • postman使用
    • 问题总结
    • idea使用技巧
  • Oauth2

    • Oauth2原理
  • 项目列表

    • redis项目
    • 微服务项目
  • 分类
  • 标签
  • 归档
  • 随笔
GitHub (opens new window)

Hincky

当有趣的人,做想做的事
  • 学习笔记

    • Vue笔记
    • Vuepress
    • nginx
  • 语言类

    • java
    • go
    • python
    • 设计模式
  • 框架类

    • Spring
    • Spring Security
    • Mybatis
  • 容器技术

    • docker
    • k8s
    • helm
    • prometheus
    • grafana
    • jenkins
  • 命令集合

    • linux命令
    • docker命令
    • git命令
    • vim命令
    • k8s命令
  • 数据库

    • sql
    • mysql
  • 协议

    • 网络模型
    • http/1.1
    • WebSocket
    • http/2
    • TLS/SSL
    • tcp
    • IP
    • tcpdump抓包命令
    • wireshark抓包工具
  • 通用

    • Git
  • 技术分享

    • git push/pull总是超时怎么办
    • idea debug技巧
    • postman使用
    • 问题总结
    • idea使用技巧
  • Oauth2

    • Oauth2原理
  • 项目列表

    • redis项目
    • 微服务项目
  • 分类
  • 标签
  • 归档
  • 随笔
GitHub (opens new window)
  • 容器技术

    • docker

    • k8s

    • helm

    • rancher

    • prometheus

      • Prometheus介绍
        • Prometheus工作流程
        • Prometheus组件介绍
          • job/exporter
          • pushgateway
        • 配置告警
      • 安装方式
        • Kube-Prometheus Stack
        • Prometheus Operator
        • 二进制安装
        • 容器安装
          • 挂载配置文件数据卷
          • Dockerfile
        • Helm安装
      • 数据来源与监控配置
        • 云原生应用
        • 非云原生应用
        • 监控
          • ServiceMonitor监控配置
          • ServiceMonitor模板
          • 监控流程
      • PromQL
        • 选择器
        • 标签匹配器
    • grafana

    • containerd

    • jenkins

  • 命令集合

  • 软路由

  • 容量保障技术

  • 运维
  • 容器技术
  • prometheus
hincky
2022-11-12
目录

安装方式

提示

对于要安装在k8s集群里面的Prometheus,推荐使用前两种安装方式

# Kube-Prometheus Stack

前提要有k8s集群

这是一个技术栈,包含:

  • Prometheus Operator
  • 高可用Prometheus
  • 高可用Alertmanager
  • 主机监控Node Exporter
  • Prometheus Adapter
  • 容器监控kube-state-metrics
  • 图形化展示grafana

因为很多东西已经集成好了,拿来就用。如果是下面的operator安装方式,还有很多东西要自己配置

github下载地址 (opens new window)

根据k8s集群版本,下载对应的Prometheus

对照表 (opens new window)

根据自己需求,修改下面release版本号

git clone -b release-0.7 https://github.com/prometheus-operator/kube-prometheus.git
cd kube-prometheus/manifests

kubectl create -f setup/
1
2
3
4

安装好了之后验证

kubectl get po -n monitoring
1

# Prometheus Operator

前提要有k8s集群

适合复杂系统环境的安装方式,比如mysql集群;可以灵活对告警等进行配置

operator会提供crd,来自定义控制器实现监控某个目标;

# 二进制安装

对于没有k8s环境,直接从官网下载二进制包进行安装 二进制安装地址 (opens new window)

# 容器安装

简单,迁移性好

docker run -p 9090:9090 prom/prometheus
1

# 挂载配置文件数据卷

docker run \
    -p 9090:9090 \
    -v /path/to/config:/etc/prometheus \
    prom/prometheus
1
2
3
4

# Dockerfile

新建一个Dockerfile

FROM prom/prometheus
ADD prometheus.yml /etc/prometheus/
1
2

然后执行Dockerfile

docker build -t my-prometheus .
docker run -p 9090:9090 my-prometheus
1
2

# Helm安装

k8s包管理工具,直接用helm安装;针对无状态应用设计

编辑 (opens new window)
#prometheus
Prometheus介绍
数据来源与监控配置

← Prometheus介绍 数据来源与监控配置→

最近更新
01
人生前期重要的能力
05-17
02
防火墙命令
04-11
03
docker-compose部署mysql主从集群
03-22
更多文章>
Theme by Vdoing | Copyright © 2022-2023 Hincky | MIT License | 粤ICP备2022120427号
  • 跟随系统
  • 浅色模式
  • 深色模式
  • 阅读模式