Categorygithub.com/teymurgahramanov/from-node-exporter
repositorypackage
0.3.0
Repository: https://github.com/teymurgahramanov/from-node-exporter.git
Documentation: pkg.go.dev

# Packages

No description provided by the author

# README

From-node exporter

The From-node Exporter for Prometheus is designed to probe the accessibility of external endpoints from each node of the Kubernetes cluster over TCP, HTTP, and ICMP.

How will it be useful?

While there are other tools like the Blackbox Exporter, the From-node Exporter focuses specifically on simplicity and efficiency for Kubernetes node-level probing. It's designed to serve a specific use case - ensuring all required endpoints are accessible from every node of your cluster.

Use case

Consider a scenario where your pods were evicted due to a node failure. The pods were then moved to new nodes that were recently added to the cluster. However, this resulted in errors and service unavailability due to a lack of access to essential external endpoints. Later, it was discovered that the security department failed to apply access rules to the new cluster nodes.

This is just one example of how node-level probes can help you identify potential issues before they become major problems.

Run

Kubernetes

Install Helm chart.

Docker

  1. Create config.yaml

  2. Run

    docker run --rm -v $(pwd)/config.yaml:/config.yaml teymurgahramanov/from-node-exporter:latest
    

Binary

  1. Download binary from the releases tab
  2. Create config.yaml
  3. Run ./from-node-exporter

config.yaml

FieldDescriptionTypeDefault
exporter.metricsListenPortInteger8080
exporter.metricsListenPathString/metrics
exporter.defaultProbeIntervalDefault interval between probes in secondsInteger22
exporter.defaultProbeTimeoutDefault timeout for probes in secondsInteger22
targetsKVs of targets to probeList
targets."target".addressTarget address. Can be URL, IP, or IP:PORT depending on chosen moduleString
targets."target".moduleModule to probe the target (tcp, http, icmp)String
targets."target".intervalProbe interval for the targetIntegerexporter.defaultProbeInterval
targets."target".timeoutProbe timeout for the targetIntegerexporter.defaultProbeTimeout

Example:

exporter:
  metricsListenPort: 3333
  metricsListenPath: /metricz
  defaultProbeInterval: 31
  defaultProbeTimeout: 13
targets:
  target1:
    address: api.example.com:8080
    module: tcp
    timeout: 15
  target2:
    address: https://example.com
    module: http
    interval: 60
  target3:
    address: 192.168.0.1
    module: icmp

Instant probes

Useful to check the availability of individual targets besides configured ones instantly. It's performed by making a POST request to /probe.

In the case of Kubernetes, it can be leveraged to perform instant probes from all nodes at once instead of doing it one by one. Try KubePing.

Example

Here is the example of probe using http module.

Request body

{
    "module": "http", 
    "address": "http://192.168.0.107:5000",
    "timeout": 1 # Optional
}

Response body

{
    "result": true # or false
}

Metrics

By default metrics and their descriptions are available on :8080/metrics.

Prometheus job example:

- job_name: from-node-exporter
  kubernetes_sd_configs:
    - role: endpoints
  relabel_configs:
    - source_labels: [__meta_kubernetes_endpoints_name]
      regex: from-node-exporter
      action: keep
    - source_labels: [__meta_kubernetes_endpoint_node_name]
      action: replace
      target_label: instance

Note

Contributing

Contributions to enhance or fix issues are welcome. Feel free to submit pull requests.