DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Newsletter
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Related

  • Node and Capacity Spillover: What Happens When Kubernetes Runs Out of Room
  • Building a Practical Cloud-Native Golden Path: A Guide to Kubernetes-Based Service Delivery, Self-Service, and Developer-Friendly Defaults
  • Kubernetes Operations Playbook: The Essentials for Keeping Scale, Complexity, and Drift Under Control
  • Making Running Optional: Scaling AI Agents on Kubernetes With Agent Substrate

Trending

  • Android Application Security: Android Application Architecture
  • How Docker Is Becoming an AI Development Platform
  • Building a Practical Cloud-Native Golden Path: A Guide to Kubernetes-Based Service Delivery, Self-Service, and Developer-Friendly Defaults
  • Who Should Grade Your AI? Rules vs LLM Judges vs Humans

Draft This article hasn't been published, so readers can't see it.

In moderation This article is waiting for review, so readers can't see it yet.

Deleted This article has been deleted, so readers can't see it.

  1. DZone
  2. Software Design and Architecture
  3. Containers
  4. Kubernetes Add-On Setup: A Step-by-Step Guide to Node Problem Detector

Kubernetes Add-On Setup: A Step-by-Step Guide to Node Problem Detector

Ensure Kubernetes cluster health with NPD. This guide walks you through setting up NPD to detect node issues like kernel errors and resource exhaustion.

By 
Sai Sandeep Ogety
DZone Core CORE ·
Nov. 25, 24 · Tutorial
Post on X (opens in a new tab) Share on LinkedIn (opens in a new tab)
3.3K Views

Join the DZone community Save articles, join the discussion, and download Refcards and Trend Reports with a free account.

Join for free Already a member? Log in

Kubernetes is a robust system, but maintaining its health is crucial for consistent performance. Node Problem Detector (NPD), a Kubernetes add-on, is designed to identify and address node-level issues like kernel errors, filesystem corruption, or resource exhaustion. This guide walks you through the step-by-step process of setting up NPD in your Kubernetes cluster.

What Is Node Problem Detector?

Node Problem Detector (NPD) is a DaemonSet that runs on every node in a Kubernetes cluster to monitor system health. It integrates with Kubernetes to report issues as Node Conditions, Events, or Metrics, enabling early detection and resolution of potential problems.

Key Features

  • Detects hardware and software issues
  • Reports node conditions to Kubernetes
  • Extends cluster monitoring capabilities
  • Supports custom problem detection configurations

Prerequisites

Before starting, ensure the following:

  1. A running Kubernetes cluster (v1.8 or later)
  2. Access to the cluster with kubectl permissions
  3. Nodes with docker or container runtime installed
  4. Basic knowledge of Kubernetes DaemonSets

Step-by-Step Guide

Step 1: Download the Node Problem Detector YAML File

Start by downloading the official deployment file from the Kubernetes GitHub repository:

Shell
 
wget https://raw.githubusercontent.com/kubernetes/node-problem-detector/master/config/node-problem-detector.yaml


This YAML file contains the configuration to deploy the NPD DaemonSet in your cluster.

Step 2: Customize the Node Problem Detector Configuration

NPD’s default configuration detects kernel issues, OOM (Out of Memory) kills, and disk pressure. You can extend it by customizing the configuration file embedded in the YAML.

For example, to detect filesystem corruption, add the following configuration:

YAML
 
- name: custom-config
  config: |
    kernel-messages:
      - type: "Permanent"
        condition: "CorruptFilesystem"
        reason: "FilesystemCorruptionDetected"
        message: "Filesystem corruption detected in kernel logs"
        pattern: "EXT4-fs error"


Save the changes before proceeding.

Step 3: Deploy Node Problem Detector

Deploy the NPD DaemonSet to your Kubernetes cluster using kubectl:

Shell
 
kubectl apply -f node-problem-detector.yaml


This will launch NPD on all the nodes in your cluster.

Step 4: Verify the Installation

To confirm the deployment is successful, check the status of the DaemonSet:

Shell
 
kubectl apply -f node-problem-detector.yaml


You should see something like this:

Shell
 
NAME                  DESIRED   CURRENT   READY   UP-TO-DATE   AVAILABLE   NODE SELECTOR   AGE
node-problem-detector 3         3         3       3            3           <none>          5m


Step 5: Monitor Node Conditions and Events

Once NPD is running, it will start detecting issues. Use the following commands to monitor node conditions and events:

Check Node Conditions

Look for conditions like DiskPressure, MemoryPressure, or custom conditions you’ve configured.

Shell
 
kubectl describe node <node-name>


Review Node Events

This displays a detailed log of problems detected by NPD.

Shell
 
kubectl get events --namespace kube-system


Step 6: Enable Persistent Logging (Optional)

To retain logs for long durations or integrate with external monitoring tools like Prometheus or ElasticSearch, configure persistent storage for logs:

  1. Mount a persistent volume for logs in the NPD configuration YAML.    
  2. Add an exporter for metrics, such as Prometheus Node Exporter, to scrape logs from NPD.

Step 7: Automate Notifications and Alerts

To stay proactive, integrate NPD with your monitoring system and set up automated alerts. For example, using Prometheus Alertmanager:

  • Configure Prometheus to scrape metrics from NPD:
Shell
 
- job_name: 'node-problem-detector'
  static_configs:
    - targets: ['<NPD_SERVICE>:<PORT>']


  • Define Alertmanager rules to notify on critical issues.

Common Troubleshooting

NPD Pods Not Starting

  • Check the logs of the DaemonSet:
Shell
 
kubectl logs -n kube-system <pod-name>


  • Verify that the node meets system requirements (e.g., kernel version).

Issues Not Being Detected

  • Ensure your configuration matches your environment.
  • Increase verbosity for debugging by editing the DaemonSet:
Shell
 
kubectl edit daemonset node-problem-detector -n kube-system


Conclusion

Node Problem Detector is a vital tool for maintaining node health in Kubernetes. By following this guide, you can effectively deploy and configure NPD to detect and address node-level issues. Remember to periodically review your configurations and integrate NPD with monitoring tools for automated alerts.

Kubernetes New product development

Opinions expressed by DZone contributors are their own.

Related

  • Node and Capacity Spillover: What Happens When Kubernetes Runs Out of Room
  • Building a Practical Cloud-Native Golden Path: A Guide to Kubernetes-Based Service Delivery, Self-Service, and Developer-Friendly Defaults
  • Kubernetes Operations Playbook: The Essentials for Keeping Scale, Complexity, and Drift Under Control
  • Making Running Optional: Scaling AI Agents on Kubernetes With Agent Substrate

Partner Resources

×

Comments

Loading comments

The comments didn't load

Please try again in a moment.

Likes

Loading

The next likes didn't load. Please try again.

The likes didn't load

Please try again in a moment.

See who liked this

Log in or join DZone for free to see who liked this article.

Log in Join for free
  • RSS
  • X
  • Facebook

ABOUT US

  • About DZone
  • Support and feedback
  • Community research

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 215
  • Nashville, TN 37211
  • [email protected]

Let's be friends:

  • RSS
  • X
  • Facebook