k8s部署针对外部服务器的prometheus服务

ConfigMap

yaml 复制代码
apiVersion: v1
kind: ConfigMap
metadata:
  name: prometheus-config-ems
data:
  prometheus.yml: |-
    global:
      scrape_interval: 15s
      evaluation_interval: 15s
    scrape_configs:
      - job_name: "emsservice"
        static_configs:
          - targets:
            - "192.165.25.160:9182"
            - "192.165.25.161:9182"
            - "192.165.25.162:9182"
            - "192.165.25.163:9182"
            - "192.165.25.164:9182"
            - "192.165.25.165:9182"
            - "192.165.25.166:9182"
            - "192.165.25.167:9182"

Deployment

yaml 复制代码
apiVersion: apps/v1
kind: Deployment
metadata:
  name: promems-deployment
spec:
  replicas: 1
  selector:
    matchLabels:
      app: promems
  template:
    metadata:
      labels:
        app: promems
    spec:
      containers:
        - name: promems
          image: prom/prometheus
          command:
          - "/bin/prometheus"
          args:
          - "--config.file=/etc/prometheus/prometheus.yml"
          ports:
            - containerPort: 9090
              protocol: TCP
          volumeMounts:
            - name: promems
              mountPath: /etc/prometheus
      volumes:
        - name: promems
          configMap:
            name: prometheus-config-ems

Service

yaml 复制代码
kind: Service
apiVersion: v1
metadata:
  labels:
    app:
  name: ems-service
  namespace: default
spec:
  type: NodePort
  ports:
    - name: http
      port: 9090
      targetPort: 9090
      protocol: TCP
      nodePort: 31004
  selector:
    app: promems
相关推荐
码农101号4 小时前
Linux中shell编程表达式和数组讲解
linux·运维·服务器
是小满满满满吗4 小时前
传输层:udp与tcp协议
linux·服务器·网络
2201_761199044 小时前
k8s4部署
云原生·容器·kubernetes
小柏ぁ5 小时前
calico/node is not ready: BIRD is not ready: BGP not established with xxx
运维·docker·kubernetes
Mintimate5 小时前
云服务器 Linux 手动 DD 安装第三方 Linux 发行版:原理与实战
linux·运维·服务器
RussellFans5 小时前
Linux 环境配置
linux·运维·服务器
网硕互联的小客服5 小时前
503 Service Unavailable:服务器暂时无法处理请求,可能是超载或维护中如何处理?
服务器·git·github
三劫散仙6 小时前
kubernetes jenkins pipeline优化拉取大仓库性能指定分支+深度
容器·kubernetes·jenkins
西京刀客6 小时前
k8s热更新-subPath 不支持热更新
云原生·容器·kubernetes·configmap·subpath
高冷的肌肉码喽6 小时前
Linux-进程间的通信
linux·运维·服务器