RocketMQ

Deployment

apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
   app.kubernetes.io/component: exporter
   app.kubernetes.io/name: rocketmq-exporter
   app.kubernetes.io/part-of: kube-prometheus
  name: rocketmq-exporter
  namespace: monitoring
spec:
  progressDeadlineSeconds: 600
  replicas: 1
  revisionHistoryLimit: 10
  selector:
    matchLabels:
      app.kubernetes.io/component: exporter
      app.kubernetes.io/name: rocketmq-exporter
      app.kubernetes.io/part-of: kube-prometheus
  strategy:
    rollingUpdate:
      maxSurge: 25%
      maxUnavailable: 25%
    type: RollingUpdate
  template:
    metadata:
      labels:
        app.kubernetes.io/component: exporter
        app.kubernetes.io/name: rocketmq-exporter
        app.kubernetes.io/part-of: kube-prometheus
    spec:
      containers:
        - args:
            - '--rocketmq.config.namesrvAddr=172.16.15.121:9876'
          image: rocketmq-exporter:latest
          imagePullPolicy: Always
          name: rocketmq-exporter
          ports:
            - containerPort: 5557
              name: http
              protocol: TCP
          resources:
            limits:
              cpu: 500m
              memory: 1024Mi
            requests:
              cpu: 10m
              memory: 512Mi
          terminationMessagePath: /dev/termination-log
          terminationMessagePolicy: File
          volumeMounts:
            - mountPath: /home/exporter/logs
              name: exporter-log
            - mountPath: /etc/localtime
              name: date-config
      dnsPolicy: ClusterFirst
      imagePullSecrets:
        - name: default-secret-harbor
      restartPolicy: Always
      schedulerName: default-scheduler
      securityContext: {}
      terminationGracePeriodSeconds: 30
      volumes:
        - emptyDir: {}
          name: exporter-log
        - hostPath:
            path: /etc/localtime
            type: ''
          name: date-config

Service

apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
  labels:
    app.kubernetes.io/component: exporter
    app.kubernetes.io/name: rocketmq-exporter
    app.kubernetes.io/part-of: kube-prometheus
  name: rocketmq-exporter
  namespace: monitoring
spec:
  endpoints:
    - interval: 15s
      port: http
      relabelings:
        - action: replace
          regex: (.*)
          replacement: $1
          sourceLabels:
            - __meta_kubernetes_pod_node_name
          targetLabel: instance
      scheme: http
  jobLabel: app.kubernetes.io/name
  targetLabels: [platform]
  selector:
    matchLabels:
      app.kubernetes.io/component: exporter
      app.kubernetes.io/name: rocketmq-exporter
      app.kubernetes.io/part-of: kube-prometheus

ServiceMonitor

apiVersion: v1
kind: Service
metadata:
  name: rocketmq-exporter
  namespace: monitoring
  labels:
    app.kubernetes.io/component: exporter
    app.kubernetes.io/name: rocketmq-exporter
    app.kubernetes.io/part-of: kube-prometheus
    platform: mos
spec:
  ports:
  - name: http
    port: 5557
    protocol: TCP
    targetPort: http
  selector:
    app.kubernetes.io/component: exporter
    app.kubernetes.io/name: rocketmq-exporter
    app.kubernetes.io/part-of: kube-prometheus
  sessionAffinity: None
  type: ClusterIP