entigolabs/pod-to-pod-prometheus

By entigolabs

Updated about 4 years ago

A health checker for kubernetes workers that creates probmetheus metrics.

Image

553

Pod To Pod Prometehus

A health checker for kubernetes workers that creates probmetheus metrics. By creating a daemonset with pod to pod installed the pods will do basic network tests to measure pod to pod and pod to node network stability. It uses ricoberger/script_exporter to create the webservers.

Building

docker build -t entigolabs/pod-to-pod-prometheus .

Docker image is in docker hub https://hub.docker.com/r/entigolabs/pod-to-pod-prometheus

docker pull entigolabs/pod-to-pod-prometheus:latest

Installation

You need to:

  • Install it on kubernetes.
  • Make prometheus scrape it.
  • Add grafana dashboard.
Kubernetes spec

Install the daemonset and service to the kubernetes cluster.

k8s-pod-to-pod-prometheus.yaml

Prometheus configuration

So prometheus could find the pods use auto discovery. You can add this configuration to prometehus scrape_configs.

    - job_name: pod-to-pod-prometheus
      metrics_path: '/probe'
      params:
        script: [ping]
      kubernetes_sd_configs:
      - role: pod
        namespaces:
          names:
          - pod-to-pod-prometheus
        selectors:
          - role: pod
            label: "app=pod-to-pod-prometheus"
      relabel_configs:
      - source_labels: [__address__, __meta_kubernetes_pod_annotation_prometheus_io_port]
        action: replace
        regex: ([^:]+)(?::\d+)?;(\d+)
        replacement: $1:$2
        target_label: __address__
      - action: labelmap
        regex: __meta_kubernetes_pod_label_(.+)
      - source_labels: [__meta_kubernetes_namespace]
        action: replace
        target_label: kubernetes_namespace
      - source_labels: [__meta_kubernetes_pod_name]
        action: replace
        target_label: kubernetes_pod_name
      - source_labels: [__address__]
        target_label: env
        replacement: "my-env-here"
Grafana dashboard for prometheus

Import the Grafana-Pod-to-Pod-Prometheus.json dashboard file to grafana. If you want to use short hostnames not FQDN then replace {{node}} -> {{nodeshort}} and {{dstnode}} -> {{dstnodeshort}} in the json.

Using perl for it.

perl -p -i -e "s/\{\{node\}\}/\{\{nodeshort\}\}/g" Grafana-Pod-to-Pod-Prometheus.json
perl -p -i -e "s/\{\{dstnode\}\}/\{\{dstnodeshort\}\}/g" Grafana-Pod-to-Pod-Prometheus.json

Docker Pull Command

docker pull entigolabs/pod-to-pod-prometheus