QA
Senior LevelDocker & Deployment

How does Node Problem Detector (NPD) report kernel deadlocks and hardware faults to the K8s control plane?

❓ Interview Prompt: Explain Node Problem Detector DaemonSet, system log monitors, custom problem plugins, and NodeCondition reporting for proactive node replacement.

Node Problem Detector (NPD) is a Kubernetes DaemonSet that monitors node health at the system level and reports problems as NodeConditions or Events to the Kubernetes API server — enabling automated remediation.

What NPD Monitors:

•
Kernel deadlocks: Detected via kernel log patterns (INFO: task ... blocked for more than 120 seconds).
•
OOM kills: Kernel OOM killer events in /var/log/kern.log.
•
NFS mount failures: Filesystem mount error patterns.
•
Hardware errors: Memory ECC errors, CPU thermal throttling, disk I/O errors via journald.
•
Docker daemon failures: Docker service crash events.

Architecture:

NPD runs as a DaemonSet with elevated privileges to read /dev/kmsg, /var/log/, and systemd journal.

It has two types of monitors:

1
SystemLogMonitor: Parses log files for regex patterns → reports NodeConditions.
2
CustomPluginMonitor: Executes custom scripts periodically → exit code 0 = OK, non-zero = problem.

NodeCondition Reporting:

NPD writes custom NodeConditions (e.g., KernelDeadlock=True) to the Node object. Cluster Autoscaler and tools like Node Auto Provisioner can use these conditions to automatically terminate and replace unhealthy nodes.

Code Implementation Example

yaml
# NPD DaemonSet configuration (simplified)
apiVersion: apps/v1
kind: DaemonSet
metadata:
  name: node-problem-detector
  namespace: kube-system
spec:
  template:
    spec:
      hostPID: true         # access host process IDs
      hostNetwork: true     # access host network
      containers:
        - name: node-problem-detector
          image: registry.k8s.io/node-problem-detector/node-problem-detector:v0.8.14
          command:
            - /node-problem-detector
            - --logtostderr
            - --system-log-monitors=/config/kernel-monitor.json
            - --custom-plugin-monitors=/config/custom-plugin.json
          securityContext:
            privileged: true  # required to read kernel logs
          volumeMounts:
            - mountPath: /var/log
              name: log
            - mountPath: /dev/kmsg
              name: kmsg
      volumes:
        - name: log
          hostPath:
            path: /var/log
        - name: kmsg
          hostPath:
            path: /dev/kmsg

# Custom plugin: check disk I/O latency
# /config/custom-disk-check.sh:
# #!/bin/bash
# LATENCY=$(iostat -x 1 1 | awk '/sda/ {print $14}')
# if (( $(echo "$LATENCY > 100" | bc -l) )); then exit 1; fi  # >100ms = fail
💡NPD DaemonSet reads kernel logs and kmsg — reports KernelDeadlock/MemoryPressure NodeConditions for automated node replacement.
🎯 Interview Key Takeaway

Node Problem Detector converts kernel-level failures (deadlocks, OOM, hardware errors) into Kubernetes NodeConditions — enabling automated node termination and replacement via cluster autoscalers.

#Kubernetes#Node Problem Detector#Kernel#NodeCondition#Reliability#Senior
Back to all Docker & Deployment Questions→

More Docker & Deployment Interview Questions

Beginner LevelDocker & Deployment

How do Docker Multi-Stage Builds minimize image size and improve security?

Beginner LevelDocker & Deployment

What is the difference between a Docker Container and a Virtual Machine (VM)?

Beginner LevelDocker & Deployment

What is the difference between a Docker Image and a Docker Container?