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. 第08讲:Flink 窗口、时间和水印

    Flink系列文章 第01讲:Flink 的应用场景和架构模型 第02讲:Flink 入门程序 WordCount 和 SQL 实现 第03讲:Flink 的编程模型与其他框架比较 第04讲:Flin ...

  2. 合宙AIR105使用Keil MDK + DAP-Link 烧录和调试

    关于AIR105 AIR105是合宙LuatOS生态下的一款芯片, 1月初上市, 开发板与摄像头一起搭售(赠送). 从配置信息看, 芯片性能相当不错: Cortex-M4F内核, 最高频率204Mhz ...

  3. docker daemon

    docker启动最先加载Docker Daemon. Docker Daemon的启动文件放在/etc/systemd/system/docker.service.d目录中,如果没有则手工创建该目录并 ...

  4. 如何在 Qt Creator 中应用 one dark pro 主题

    前言 Qt Creator 自带了几款主题,但是并不好看.在博客 <Qt Creator打造VScode one dark pro主题配色> 中给出了 one dark pro 主题的配置 ...

  5. Jackson 高级应用

    转自:https://www.ibm.com/developerworks/cn/java/jackson-advanced-application/index.html 格式处理(含日期格式) 不同 ...

  6. MySQL server has gone away 异常

    原因 一种可能是发送的SQL语句太长,以致超过了max_allowed_packet的大小,如果是这种原因,你只要修改my.cnf,加大max_allowed_packet的值即可. 还有一种可能是因 ...

  7. 关于Java的=赋值操作和方法传递对象时的引用

    原创:转载需注明原创地址 https://www.cnblogs.com/fanerwei222/p/11405920.html 下面通过一段代码和debug结果来展示Java中=操作的赋值改变过程. ...

  8. iOS 获取通讯录中联系人的所有属性 by - zfqj

    1 ABAddressBookRef addressBook = ABAddressBookCreate(); 2 3 CFArrayRef results = ABAddressBookCopyAr ...

  9. .netcore基础知识(一)

    先来说说web服务器  先来一张图 一个典型的进程外托管模型 我们先看kestrel这一部分 我们在它前面放了一个方向代理服务器nginx 对http请求做预处理 kestrel本身是可以直接用作we ...

  10. Ubuntu20.04 PostgreSQL 14 安装配置记录

    PostgreSQL 名称来源 It was originally named POSTGRES, referring to its origins as a successor to the Ing ...