# kubernetes/node-problem-detector architecture

> Architecture diagram of the GitHub repository kubernetes/node-problem-detector, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-22). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/kubernetes/node-problem-detector
- Repository: https://github.com/kubernetes/node-problem-detector

## Overview

##### Main Components

a. Core Components:
- Problem Detector Core
- Problem Daemons
- Exporters
- API Server Interface

b. Problem Daemon Types:
- SystemLogMonitor
- SystemStatsMonitor
- CustomPluginMonitor
- HealthChecker

c. Exporters:
- Kubernetes Exporter
- Prometheus Exporter
- Stackdriver Exporter

**┌─────────────────────────────────────────── Node ───────────────────────────────────────────┐**

- ┌─────────────────────────── Node Problem Detector ──────────────────────────┐           │

- ┌─────────────────────── Problem Daemons ──────────────────────┐         │           │

- ┌─────────────┐   ┌──────────────┐   ┌──────────────┐      │         │           │
- System Log   │   │System Stats  │   │Custom Plugin │      │         │           │
- Monitor      │   │Monitor       │   │Monitor       │      │         │           │
- ┘   └──────────────┘   └──────────────┘      │         │           │

- ┌─────────────┐                                            │         │           │
- Health       │                                            │         │           │
- Checker      │                                            │         │           │
- ┘                                            │         │           │

- ┌─────────────────────── Exporters ────────────────────────┐           │           │

- ┌─────────────┐   ┌──────────────┐   ┌──────────────┐  │           │           │
- Kubernetes   │   │Prometheus    │   │Stackdriver    │  │           │           │
- Exporter     │   │Exporter      │   │Exporter      │  │           │           │
- ┘   └──────────────┘   └──────────────┘  │           │           │
- ┘           │           │
- ┘           │

- ┘

**┌─────────────────────── External Systems ───────────────────────┐**

- ┌─────────────┐   ┌──────────────┐   ┌──────────────────┐   │
- Kubernetes   │   │Prometheus    │   │Stackdriver       │   │
- API Server   │   │Server        │   │Monitoring       │   │
- ┘   └──────────────┘   └──────────────────┘   │

- ┘

- Monitoring flows from system resources to problem daemons
- Reporting flows from problem daemons to exporters
- External communication flows from exporters to external systems

##### Additional Elements
- Monitoring targets (logs, metrics, health checks)
- Configuration paths
- Version information

##### Key Interactions to Highlight
- Problem detection flow
- Reporting mechanisms (Events vs NodeConditions)
- Integration with Kubernetes cluster
- Metric collection and export paths

##### Important Notes
- Optional components (like Stackdriver exporter)
- Platform-specific elements (Windows vs Linux)
- Configuration points
- Scalability aspects

- Clear hierarchical layouts
- Export to high-resolution formats

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Node
        subgraph NPD[Node Problem Detector]
            Core["Problem Detector Core"]
            click Core "https://github.com/kubernetes/node-problem-detector/blob/master/pkg/problemdetector/problem_detector.go"
            
            subgraph ProblemDaemons[Problem Daemons]
                PDB["Problem Daemon Base"]
                click PDB "https://github.com/kubernetes/node-problem-detector/blob/master/pkg/problemdaemon/problem_daemon.go"
                
                SLM["System Log Monitor"]
                click SLM "https://github.com/kubernetes/node-problem-detector/blob/master/pkg/systemlogmonitor/log_monitor.go"
                
                SSM["System Stats Monitor"]
                click SSM "https://github.com/kubernetes/node-problem-detector/blob/master/pkg/systemstatsmonitor/system_stats_monitor.go"
                
                CPM["Custom Plugin Monitor"]
                click CPM "https://github.com/kubernetes/node-problem-detector/blob/master/pkg/custompluginmonitor/custom_plugin_monitor.go"
                
                HC["Health Checker"]
                click HC "https://github.com/kubernetes/node-problem-detector/blob/master/pkg/healthchecker/health_checker.go"
            end
            
            subgraph Exporters
                KE["Kubernetes Exporter"]
                click KE "https://github.com/kubernetes/node-problem-detector/blob/master/pkg/exporters/k8sexporter/k8s_exporter.go"
                
                PE["Prometheus Exporter"]
                click PE "https://github.com/kubernetes/node-problem-detector/blob/master/pkg/exporters/prometheusexporter/prometheus_exporter.go"
                
                SE["Stackdriver Exporter"]
                click SE "https://github.com/kubernetes/node-problem-detector/blob/master/pkg/exporters/stackdriver/stackdriver_exporter.go"
            end
            
            PDPlugins["Problem Daemon Plugins"]
            click PDPlugins "https://github.com/kubernetes/node-problem-detector/tree/master/cmd/nodeproblemdetector/problemdaemonplugins/"
            
            EPlugins["Exporter Plugins"]
            click EPlugins "https://github.com/kubernetes/node-problem-detector/tree/master/cmd/nodeproblemdetector/exporterplugins/"
            
            MainEntry["Node Problem Detector Entry"]
            click MainEntry "https://github.com/kubernetes/node-problem-detector/blob/master/cmd/nodeproblemdetector/node_problem_detector.go"
        end
    end
    
    subgraph ExternalSystems[External Systems]
        K8S["Kubernetes API Server"]
        Prometheus["Prometheus Server"]
        Stackdriver["Stackdriver Monitoring"]
    end
    
    %% Core connections
    MainEntry --> Core
    Core --> PDB
    
    %% Problem Daemon connections
    PDB --> SLM & SSM & CPM & HC
    PDPlugins --> PDB
    
    %% Exporter connections
    Core --> KE & PE & SE
    EPlugins --> KE & PE & SE
    
    %% External system connections
    KE --> K8S
    PE --> Prometheus
    SE --> Stackdriver
    
    %% Styling
    classDef core fill:#2374ab
    classDef daemon fill:#2a9d8f
    classDef exporter fill:#e9c46a
    classDef external fill:#grey
    classDef plugin fill:#f4a261
    
    class Core,MainEntry core
    class PDB,SLM,SSM,CPM,HC daemon
    class KE,PE,SE exporter
    class K8S,Prometheus,Stackdriver external
    class PDPlugins,EPlugins plugin
```
