这个系列的东东满多的。要另开系列说明。

这里为了内容连续完成,先贴一个吧,其它configmap,exporter就不展示。

为了保持统一,将prometheus也放到二级目录了。

- '--web.external-url=/prometheus'

apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRole
metadata:
  name: prometheus
rules:
  - apiGroups: [""] # "" indicates the core API group
    resources:
      - nodes
      - nodes/proxy
      - services
      - endpoints
      - pods
    verbs:
      - get
      - watch
      - list
  - apiGroups:
      - extensions
    resources:
      - ingresses
    verbs:
      - get
      - watch
      - list
  - nonResourceURLs: ["/metrics"]
    verbs:
      - get
---
apiVersion: v1
kind: ServiceAccount
metadata:
  name: prometheus
  namespace: kube-system
  labels:
    app: prometheus
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRoleBinding
metadata:
  name: prometheus
subjects:
  - kind: ServiceAccount
    name: prometheus
    namespace: kube-system
roleRef:
  kind: ClusterRole
  name: prometheus
  apiGroup: rbac.authorization.k8s.io
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: prometheus
  namespace: kube-system
  labels:
    app: prometheus
spec:
  replicas: 1
  template:
    metadata:
      name: prometheus
      labels:
        app: prometheus
    spec:
#      hostNetwork: true
      serviceAccountName: prometheus
      containers:
      - name: prometheus
        image: harbor.xxx.cn/3rd_part/prom/prometheus:v2.9.2
        imagePullPolicy: IfNotPresent
        args:
          - '--storage.tsdb.path=/prometheus/data/'
          - '--storage.tsdb.retention=1d'
          - '--config.file=/etc/prometheus/prometheus.yaml'
          - '--web.enable-lifecycle'
          - '--web.external-url=/prometheus'
        ports:
        - name: webui
          containerPort: 9090
        resources:
          requests:
            cpu: 401m
            memory: 500M
        #  limits:
        #    cpu: 500m
        #    memory: 500M
        volumeMounts:
        - name: config-volume
          mountPath: /etc/prometheus
        - name: rules-volume
          mountPath: /etc/prometheus-rules
      volumes:
      - name: config-volume
        configMap:
          name: prometheus
      - name: rules-volume
        configMap:
          name: prometheus-rules
      nodeSelector:
        node-role.kubernetes.io/master: ""
      tolerations:
      - key: "node-role.kubernetes.io/master"
        effect: "NoSchedule"
---
apiVersion: v1
kind: Service
metadata:
  name: prometheus
  namespace: kube-system
  labels:
    app: prometheus
  annotations:
    prometheus.io/scrape: 'true'
spec:
  ports:
    - name: webui
      port: 9090
      protocol: TCP
  selector:
    app: prometheus

k8s安装之prometheus.yaml的更多相关文章

  1. k8s安装之kube-state-metrics.yaml

    概述 已经有了cadvisor.heapster.metric-server,几乎容器运行的所有指标都能拿到,但是下面这种情况却无能为力: 我调度了多少个replicas?现在可用的有几个? 多少个P ...

  2. k8s安装之nginx.yaml

    这里两个nginx.一个是用来测试最简单的集群的. 另一个是用来作grafana,prometheus,dashboard前端安全展示的. 简单版 apiVersion: apps/v1 kind: ...

  3. k8s安装之dashboard.yaml

    这个我使用了nodeport方式导出来. 为了安装,最好在前面加个nginx作密码验证... 这个端口,可以通过防火墙禁掉. # Copyright 2017 The Kubernetes Autho ...

  4. k8s安装之calico.yaml

    这个calico有点长,我也没有仔细看完. 但部署上去是可用的. 如果节点超过200台,那最好要另外一套配置... 而对于我们,差不多下面的配置够用了. veth_mtu: "1440&qu ...

  5. k8s安装之node-autoapprove-certificate-server.yaml

    kubelet证书分为server和client两种, k8s 1.9默认启用了client证书的自动轮换,但server证书自动轮换需要用户开启.方法是: 2.1 增加 kubelet 参数(现已默 ...

  6. k8s安装之eventrouter.yaml

    k8s的heapster项目中止以后, 事件收集的项目,就推荐使用https://github.com/heptiolabs/eventrouter项目了 Eventrouter This repos ...

  7. k8s安装之flannel.yaml

    收藏一下,以后直接从这里cp过来用的. flannel新版 --- apiVersion: extensions/v1beta1 kind: PodSecurityPolicy metadata: n ...

  8. k8s安装之grafana.yaml

    这个作展示,够用. 为了使用nginx统一管理, 这里将grafana放在子目录下. - name: GF_SERVER_ROOT_URL  value: "%(protocol)s://% ...

  9. k8s 安装 prometheus 过程记录

    开始以为只要安装 prometheus-operator 就行了. git clone https://github.com/coreos/prometheus-operator.git cd pro ...

随机推荐

  1. [LeetCode] 680. Valid Palindrome II 验证回文字符串 II

    Given a non-empty string s, you may delete at most one character. Judge whether you can make it a pa ...

  2. linux中安装cx_Oracle

    https://blog.csdn.net/w657395940/article/details/41144225 各种尝试都,最后 pip install cx-Oracle 成功导入

  3. Java项目main方法启动的两种方式

    1.打包时指定了主类,可以直接用java -jar xxx.jar. <!--main方法打包jar包插件--> <plugin> <artifactId>mave ...

  4. Burp Suite 如何抓取HTTPS请求

    1,下载安装burp suite工具 https://portswigger.net/burp/communitydownload 如果是windows系统,选择windows点击Download下载 ...

  5. 使用pyinstaller将python打包成exe文件

    步骤: 1)win+R 输入cmd打开dos窗口   2)先安装pyinstaller: pip install pyinstaller 3)然后使用cd命令进入项目文件的路径下:   4)再使用命令 ...

  6. java File源码理解,探索File路径

    1.方法: new File(path); 我们知道根据输入的路径path的不同 ,File可以根据path的不同格式,来访问文件.那么,path的形式有几种呢? 根据源码 可以知道,输入的路径pat ...

  7. Coursera,Udacity,Edx 课程列表(更新ing)

    Coursera,Udacity,Edx 课程列表(更新ing) Coursera有很多特别好的课程,平时没有机会听到国外大牛的课程,通过Coursera算是可以弥补一下吧,国外的课程普遍比国内的老师 ...

  8. [hdu 4841]圆桌问题 | 约瑟夫问题 STL-vector

    原题 问题描述: 经典的约瑟夫问题,有2n个人,其中n个好人n个坏人,使得删去n人后,剩下的全为好人.m为每次数的人数. n<=32767 题解: 首先考虑n的范围,暴力肯定行不通,所以会想到线 ...

  9. as3效率优化

    1.改进算法无论对于那一种程序,好的算法总是非常重要的,而且能够极大地提高程序性能,所以任何性能的优化第一步就是从算法或者说程序逻辑的优化开始,检查自己的程序是否有多余的运算,是否在没有必要的时候做了 ...

  10. idea 中激活 JRebel

    JRebel介绍: JRebel是一款JVM插件,它使得Java代码修改后不用重启系统,立即生效.IDEA上原生是不支持热部署的,一般更新了 Java 文件后要手动重启 Tomcat 服务器,修改才能 ...