Skip to content

Measure network delays between Kubernetes Nodes using Netperf & Prometheus.

License

Notifications You must be signed in to change notification settings

AposLaz/kube-netlag

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

53 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Kube-NetLag

Kube-NetLag Logo

Table of Contents

Overview

Kube-NetLag is a lightweight network performance testing and latency simulation tool deployed as a DaemonSet across your Kubernetes cluster. It helps measure network delays between nodes, making it useful for debugging and optimizing cluster communication.

You can deploy Kube-NetLag using either Kubernetes manifests or a Helm chart. The Helm chart simplifies deployment and configuration, enabling seamless monitoring with Prometheus integration.

Features

  • βœ… Network performance testing using Netperf.
  • πŸ“Š Prometheus metrics exposure for monitoring.
  • βš™οΈ Customizable ports & environment variables for flexibility.
  • πŸ“‘ Automatic Prometheus configuration (optional).

Tested Kubernetes Distributions

Kube-NetLag has been successfully tested on the following Kubernetes distributions:

  • βœ… Rancher Kubernetes
  • πŸ”„ More distributions to be tested...

If you tested it on another Kubernetes distribution, feel free to contribute and share your feedback!

Installation

Prerequisites

  • Kubernetes 1.26+
  • Helm 3.0+
  • Prometheus (if monitoring is required)

Deploy using Kubernetes Manifests

The manifest files are located in the manifests directory.

kubectl apply -f manifests/

Deploy using Helm Chart

Install the Chart

To install Kube-NetLag with default values:

helm repo add alazidis https://your-helm-repo-url
helm install kube-netlag alazidis/kube-netlag

To install with a custom configuration:

helm install kube-netlag alazidis/kube-netlag -f values.yaml

Testing the Deployment

Verify that the DaemonSet is running:

kubectl get pods -n kube-netlag

Check logs to confirm proper operation:

kubectl logs -l app.kubernetes.io/name=kube-netlag -n kube-netlag

Uninstall the Chart

To completely remove Kube-NetLag, run:

helm uninstall kube-netlag
kubectl delete namespace kube-netlag

Configuration

The Helm chart allows full customization via the values.yaml file.

Global Parameters

Parameter Description Default
image.repository Docker image repository alazidis/kube-netlag
image.tag Image tag Chart.Version
image.pullPolicy Image pull policy Always
namespaceOverride Overrides the namespace for deployment ""

Network & Ports

Parameter Description Default
ports.containerPort Netperf service port 12865
ports.hostPort Host-mapped Netperf port 12865
ports.containerPort Prometheus metrics port 9090
ports.hostPort Host-mapped Prometheus port 9090

Note: If modifying ports, update extraEnv accordingly.


Prometheus Configuration

Parameter Description Default
prometheusConfig.create Enable automatic Prometheus ConfigMap true
prometheusConfig.namespace Namespace for Prometheus ConfigMap ""

Resource Allocation

Parameter Description Default
resources.requests.cpu Requested CPU 200m
resources.requests.memory Requested Memory 40Mi
resources.limits.cpu CPU limit 400m
resources.limits.memory Memory limit 80Mi

Prometheus Integration

If prometheusConfig.create is set to true, a Prometheus scrape job will be automatically created:

- job_name: "kube-netlag-daemon"
  kubernetes_sd_configs:
    - role: pod
      namespaces:
        names:
          - {{ .Values.namespaceOverride | default .Release.Namespace }}
  relabel_configs:
    - source_labels: [__meta_kubernetes_pod_label_app]
      action: keep
      regex: {{ include "..name" . }}
    - source_labels: [__meta_kubernetes_namespace]
      action: keep
      regex: {{ .Values.namespaceOverride | default .Release.Namespace }}
      .....

Prometheus will automatically collect network latency and performance metrics from Kube-NetLag.

Exposed Prometheus Metrics

Kube-NetLag provides the following Prometheus metrics to monitor network latency between Kubernetes nodes.

Latency Metrics

Metric Name Description
node_min_latency_ms Minimum latency in microseconds between nodes.
node_max_latency_ms Maximum latency in microseconds between nodes.
node_avg_latency_ms Average latency in microseconds between nodes.

Each metric includes the following labels:

  • from_node – Name of the source node (The current Node).
  • to_node – Name of the destination node.
  • from_ip – IP address of the source node.
  • to_ip – IP address of the destination node.

Example Prometheus Query

To visualize average latency between nodes in Prometheus:

node_avg_latency_ms{from_node="node-1", to_node="node-2"}

Contributing

We welcome contributions from the community! πŸš€
If you'd like to report an issue, request a feature, or contribute code, please check out our:

Code of Conduct

We follow the Contributor Covenant Code of Conduct.
Please be respectful and inclusive to all community members.

Disclaimer

Kube-NetLag is not an official Kubernetes project and is not affiliated with or endorsed by the Cloud Native Computing Foundation (CNCF) or Kubernetes.

License

Kube-NetLag is licensed under the Apache 2.0 License.
By contributing, you agree that your code will also be licensed under Apache 2.0.

πŸ”— Read the full license here: LICENSE

Author

  • Apostolos Lazidis πŸš€