diff --git a/README.md b/README.md index 431a442e7..e10fd942c 100644 --- a/README.md +++ b/README.md @@ -70,6 +70,7 @@ Refer [heapster docs](https://github.com/kubernetes/heapster/blob/master/docs/so * `--hostname-override`: A customized node name used for node-problem-detector to update conditions and emit events. node-problem-detector gets node name first from `hostname-override`, then `NODE_NAME` environment variable and finally fall back to `os.Hostname`. ## Build Image + Run `make` in the top directory. It will: * Build the binary. * Build the docker image. The binary and `config/` are copied into the docker image. @@ -78,48 +79,15 @@ Run `make` in the top directory. It will: to another registry ## Start DaemonSet -* Create a file node-problem-detector.yaml with the following yaml. -```yaml -apiVersion: extensions/v1beta1 -kind: DaemonSet -metadata: - name: node-problem-detector -spec: - template: - spec: - containers: - - name: node-problem-detector - image: gcr.io/google_containers/node-problem-detector:v0.2 - imagePullPolicy: Always - securityContext: - privileged: true - env: - - name: NODE_NAME - valueFrom: - fieldRef: - fieldPath: spec.nodeName - volumeMounts: - - name: log - mountPath: /log - readOnly: true - - name: localtime - mountPath: /etc/localtime - readOnly: true - volumes: - - name: log - # Config `log` to your system log directory - hostPath: - path: /var/log/ - - name: localtime - hostPath: - path: /etc/localtime -``` + +* Define a daemonset similar to [node-problem-detector.yaml][node-problem-detector.yaml]. * Edit node-problem-detector.yaml to fit your environment: Set `log` volume to your system log diretory. (Used by SystemLogMonitor) * Create the DaemonSet with `kubectl create -f node-problem-detector.yaml` -* If needed, you can use [ConfigMap](http://kubernetes.io/docs/user-guide/configmap/) +* If needed, you can use a [ConfigMap](http://kubernetes.io/docs/user-guide/configmap/) to overwrite the `config/`. ## Start Standalone + To run node-problem-detector standalone, you should set `inClusterConfig` to `false` and teach node-problem-detector how to access apiserver with `apiserver-override`. diff --git a/node-problem-detector.yaml b/node-problem-detector.yaml index 7b742f5b1..5f6d02f95 100644 --- a/node-problem-detector.yaml +++ b/node-problem-detector.yaml @@ -27,6 +27,9 @@ spec: - name: log mountPath: /var/log readOnly: true + - name: kmsg + mountPath: /dev/kmsg + readOnly: true # Make sure node problem detector is in the same timezone # with the host. - name: localtime @@ -40,6 +43,9 @@ spec: # Config `log` to your system log directory hostPath: path: /var/log/ + - name: kmsg + hostPath: + path: /dev/kmsg - name: localtime hostPath: path: /etc/localtime diff --git a/pkg/systemlogmonitor/README.md b/pkg/systemlogmonitor/README.md index c16fd547e..56cf4a335 100644 --- a/pkg/systemlogmonitor/README.md +++ b/pkg/systemlogmonitor/README.md @@ -8,10 +8,11 @@ the configuration files. ( [`config/kernel-monitor.json`](https://github.com/kubernetes/node-problem-detector/blob/master/config/kernel-monitor.json) as an example). The rule list is extensible. -## Limitations +## Supported sources -* System Log Monitor only supports file based log and journald now, but it is easy - to extend it with [new log watcher](#new-log-watcher) +* System Log Monitor currently supports file-based logs, journald, and kmsg. + Additional sources can be added by implementing a [new log + watcher](#new-log-watcher). ## Add New NodeConditions @@ -44,10 +45,10 @@ with new rule definition: System log monitor supports different log management tools with different log watchers: -* [filelog](https://github.com/kubernetes/node-problem-detector/blob/master/pkg/systemlogmonitor/logwatchers/filelog): Log watcher for +* [filelog](./logwatchers/filelog): Log watcher for arbitrary file based log. -* [journald](https://github.com/kubernetes/node-problem-detector/blob/master/pkg/systemlogmonitor/logwatchers/journald): Log watcher for -journald. +* [journald](.//logwatchers/journald): Log watcher for +* [kmsg](./logwatchers/kmsg): Log watcher for the kernel ring buffer device, /dev/kmsg. Set `plugin` in the configuration file to specify log watcher. ### Plugin Configuration @@ -66,6 +67,7 @@ Log watcher specific configurations are configured in `pluginConfig`. * timestampFormat: The format of the timestamp. The format string is the time `2006-01-02T15:04:05Z07:00` in the expected format. (See [golang timestamp format](https://golang.org/pkg/time/#pkg-constants)) +* **kmsg** ### Change Log Path @@ -78,6 +80,6 @@ field in the configurtion file is the log path. You can always configure ### New Log Watcher -System log monitor uses [Log -Watcher](https://github.com/kubernetes/node-problem-detector/blob/master/pkg/systemlogmonitor/logwatchers/types/log_watcher.go) to support different log management tools. -It is easy to implement a new log watcher. +System log monitor uses [Log Watcher](./logwatchers/types/log_watcher.go) to +support different log management tools. It is easy to implement a new log +watcher.