1、k8s 监控资源对象

2、 prometheus简单介绍。 https://github.com/prometheus

•多维数据模型:由度量名称和键值对标识的时间序列数据
•PromSQL:一种灵活的查询语言,可以利用多维数据完成复杂的查询
•不依赖分布式存储,单个服务器节点可直接工作
•基于HTTP的pull方式采集时间序列数据
•推送时间序列数据通过PushGateway组件支持
•通过服务发现或静态配置发现目标
•多种图形模式及仪表盘支持(grafana)

组件介绍:

3、prometheus 部署。

[root@VM_0_48_centos prometheus]# cat  prometheus-statefulset.yaml
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: prometheus
namespace: kube-system
labels:
k8s-app: prometheus
kubernetes.io/cluster-service: "true"
addonmanager.kubernetes.io/mode: Reconcile
version: v2.2.1
spec:
serviceName: "prometheus"
replicas: 1
podManagementPolicy: "Parallel"
updateStrategy:
type: "RollingUpdate"
selector:
matchLabels:
k8s-app: prometheus
template:
metadata:
labels:
k8s-app: prometheus
annotations:
scheduler.alpha.kubernetes.io/critical-pod: ''
spec:
priorityClassName: system-cluster-critical
serviceAccountName: prometheus
initContainers:
- name: "init-chown-data"
image: "busybox:latest"
imagePullPolicy: "IfNotPresent"
command: ["chown", "-R", "65534:65534", "/data"]
volumeMounts:
- name: prometheus-data
mountPath: /data
subPath: ""
containers:
- name: prometheus-server-configmap-reload
image: "jimmidyson/configmap-reload:v0.1"
imagePullPolicy: "IfNotPresent"
args:
- --volume-dir=/etc/config
- --webhook-url=http://localhost:9090/-/reload
volumeMounts:
- name: config-volume
mountPath: /etc/config
readOnly: true
resources:
limits:
cpu: 10m
memory: 10Mi
requests:
cpu: 10m
memory: 10Mi - name: prometheus-server
image: "prom/prometheus:v2.2.1"
imagePullPolicy: "IfNotPresent"
args:
- --config.file=/etc/config/prometheus.yml
- --storage.tsdb.path=/data
- --web.console.libraries=/etc/prometheus/console_libraries
- --web.console.templates=/etc/prometheus/consoles
- --web.enable-lifecycle
ports:
- containerPort: 9090
readinessProbe:
httpGet:
path: /-/ready
port: 9090
initialDelaySeconds: 30
timeoutSeconds: 30
livenessProbe:
httpGet:
path: /-/healthy
port: 9090
initialDelaySeconds: 30
timeoutSeconds: 30
# based on 10 running nodes with 30 pods each
resources:
limits:
cpu: 200m
memory: 1000Mi
requests:
cpu: 200m
memory: 1000Mi volumeMounts:
- name: config-volume
mountPath: /etc/config
- name: prometheus-data
mountPath: /data
subPath: ""
terminationGracePeriodSeconds: 300
volumes:
- name: config-volume
configMap:
name: prometheus-config
- name: prometheus-data
persistentVolumeClaim:
claimName: prometheus-claim #采用静态PV,必须现部署
[root@VM_0_48_centos prometheus]# cat   prometheus-service.yaml
kind: Service
apiVersion: v1
metadata:
name: prometheus
namespace: kube-system
labels:
kubernetes.io/name: "Prometheus"
kubernetes.io/cluster-service: "true"
addonmanager.kubernetes.io/mode: Reconcile
spec:
type: NodePort #使用NodePort 访问
ports:
- name: http
port: 9090
protocol: TCP
targetPort: 9090
selector:
k8s-app: prometheus
[root@VM_0_48_centos ~]# kubectl  get svc  -n kube-system |grep prometheus
prometheus NodePort 10.0.0.94 <none> 9090:48403/TCP 39h

  

k8s全方位监控-prometheus部署的更多相关文章

  1. k8s全方位监控 -prometheus实现短信告警接口编写(python)

    1.prometheus短信告警接口实现(python)源码如下: import subprocess from flask import Flask from flask import reques ...

  2. k8s全方位监控-prometheus-alertmanager部署-配置第一条告警邮件

    1.alertmanager告警插件部署 [root@VM_0_48_centos prometheus]# cat alertmanager-pvc.yaml apiVersion: v1 kind ...

  3. K8S(13)监控实战-部署prometheus

    k8s监控实战-部署prometheus 目录 k8s监控实战-部署prometheus 1 prometheus前言相关 1.1 Prometheus的特点 1.2 基本原理 1.2.1 原理说明 ...

  4. k8s全方位监控-prometheus-配置文件介绍以及基于文件服务发现

    1.scrape_configs 参数介绍 # 默认的全局配置 global: scrape_interval: 15s # 采集间隔15s,默认为1min一次 evaluation_interval ...

  5. k8s全方位监控中-常用rules配置

    [root@VM_0_48_centos prometheus]# cat alertmanager-configmap.yaml apiVersion: v1 kind: ConfigMap met ...

  6. Prometheus 监控K8S Node监控

    Prometheus 监控K8S Node监控 Prometheus社区提供的NodeExporter项目可以对主机的关键度量指标进行监控,通过Kubernetes的DeamonSet可以在各个主机节 ...

  7. K8S的Kafka监控(Prometheus+Grafana)

    欢迎访问我的GitHub https://github.com/zq2599/blog_demos 内容:所有原创文章分类汇总及配套源码,涉及Java.Docker.Kubernetes.DevOPS ...

  8. k8s集群中部署prometheus server

    1.概述 本文档主要介绍如何在k8s集群中部署prometheus server用来作为监控的数据采集服务器,这样做可以很方便的对k8s集群中的指标.pod的.节点的指标进行采集和监控. 2.下载镜像 ...

  9. Prometheus部署各服务的Node监控

    1.部署监控主机 部署主机监控,需要安装node_exporter 1.1 下载node exporter wget https://github.com/prometheus/node_export ...

随机推荐

  1. HTML元素的隐藏方式

    感谢原文作者:幼儿园中的小小白 原文链接:https://blog.csdn.net/weixin_43846130/article/details/95963426 一.元素的隐藏方式: 1.dis ...

  2. 【linux命令】wget

    感谢作者:八雲苗 链接:https://www.jianshu.com/p/1c3847fa7e45 wget官方文档:wget wget是一个使用HTTP,HTTPS,FTP和FTPS协议来下载文件 ...

  3. SlidingMenu addIgnoreView() 无效的bug解决方法

    ## 感谢大佬:https://blog.csdn.net/fuchaosz/article/details/51513288 1 简介 最近在做侧滑的时候用到了SlidingMenu,在MainAc ...

  4. Java注解和注解处理器使用方法

    原创:转载需注明原创地址 https://www.cnblogs.com/fanerwei222/p/11492274.html 准备材料: 实体类: PrintDemo 注解类: PrintName ...

  5. 关于final关键字

    final修饰基本数据类型时 修饰的变量值不可变 final修饰引用数据类型时 修饰的变量地址不可变 值可变 final修饰一个类中的方法时 不可被子类重写 final修饰一个类时 不可被其他类继承 ...

  6. JabRef

    # JabRef 下载 https://www.fosshub.com/JabRef.html # JabRef 安装 自己更改下目录直接安装接可以了 # 新建自己的库, 然后点击保存就可以了. # ...

  7. 原来VIM还可以这样玩

    文章目录 配置文件vimrc vim 状态栏 状态栏配置内容 状态栏常用信息 显示状态栏 终端安全色 vimrc 配置文件 推荐 vi/vim命令大全 vim参阅 配置文件vimrc 在vim文件中执 ...

  8. centos7.+系统,mysql主从部署

    两台服务器或者两个虚拟机 主库:master    IP:192.168.85.152 从库:slave      IP:192.168.85.153 关闭主库防火墙或者放行mysql的3306端口, ...

  9. 详细介绍Windows下也能够使用osw性能升级历史

    1.Windows系统历史性能分析困难背景 在Linux/Unix上.要追朔历史性能,一般採用部署nmon进行性能监控採集与存储的方式实现.可是却没有在Windows上的版本号. Windows系统假 ...

  10. git使用小技巧-忽略提交文件设置

    前言 我们可以把自己的代码放到github上,但是我们有的文件或者文件夹不想提交到github上,这时候用到一个忽略文件 操作方法 * 在项目根目录创建一个 .gitignore文件 * 打开.git ...