Thanks to visit codestin.com
Credit goes to github.com

Skip to content

teymurgahramanov/kubeping

Repository files navigation

KubePing

It is a Kubernetes solution designed to monitor the availability of external endpoints from each node of the Kubernetes cluster over TCP, HTTP, and ICMP. It exports Prometheus metrics and has a user-friendly web interface that helps you save time instead of making telnet/curl on each node.

Use case

In Kubernetes environments, ensuring the accessibility of external endpoints is crucial. Whether it's databases, APIs, or third-party services, connectivity issues can lead to degraded application performance or outages. Traditionally, engineers troubleshoot these issues by manually running telnet, curl, or ping commands on individual nodes. However, this process is time-consuming and inefficient, especially in large-scale clusters.

KubePing helps to solve these issues🎉

Imagine a situation where your pods were evicted because of a node failure. The pods were then relocated to new nodes that had recently been added to the cluster. Unfortunately, this caused errors and resulted in service unavailability due to a lack of access to essential external endpoints. It was later discovered that the security department had failed to apply the appropriate access rules to the new cluster nodes.

This is just one scenario that highlights how KubePing can help you identify potential issues before they escalate into major problems.

How It Works

The solution runs a lightweight DaemonSet in Kubernetes, ensuring that each node has a running instance. These instances probe external endpoints over:

TCP – Checking port availability (e.g., database:5432, api:443)
HTTP – Ensuring services respond with the expected status codes
ICMP (Ping) – Verifying network reachability

The results are aggregated and exposed as Prometheus metrics:

probe_result{address="api.example.com:8080", instance="worker-node-1", job="kubeping", module="tcp", target="target1"}=1
probe_result{address="api.example.com:8080", instance="worker-node-2", job="kubeping", module="tcp", target="target1"}=0
probe_result{address="api.example.com:8080", instance="worker-node-3", job="kubeping", module="tcp", target="target1"}=1

probe_result{address="https://example.com", instance="worker-node-1", job="kubeping", module="http", target="target2"}=0
probe_result{address="https://example.com", instance="worker-node-2", job="kubeping", module="http", target="target2"}=1
probe_result{address="https://example.com", instance="worker-node-3", job="kubeping", module="http", target="target2"}=1

probe_result{address="192.168.0.1", instance="worker-node-1", job="kubeping", module="icmp", target="target3"}=1
probe_result{address="192.168.0.1", instance="worker-node-2", job="kubeping", module="icmp", target="target3"}=0
probe_result{address="192.168.0.1", instance="worker-node-3", job="kubeping", module="icmp", target="target3"}=1

And instead of SSH-ing into nodes, you can simply visit the web UI, where you can perform an ad-hoc connectivity test:

Here is how KubePing can be integrated into your workflow:

Installation

Helm

Clone repository

git clone https://github.com/teymurgahramanov/kubeping.git && cd kubeping

Install Helm chart

helm upgrade --install kubeping ./helm

Test Web UI

kubectl port-forward svc/kubeping-web 8000:8000

To configure the exporter with static targets, refer to values.yaml. Here is an example:

exporter:
  config:
    exporter:
      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

Prometheus

Example job configuration:

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

About

It's like a "ping", but just for Kubernetes!

Topics

Resources

License

Stars

Watchers

Forks

Contributors 2

  •  
  •