From d9c68c1b6b77e715f4dad69c89db0acfcc0f21fa Mon Sep 17 00:00:00 2001 From: Julien Senon Date: Thu, 22 Mar 2018 16:05:46 +0100 Subject: [PATCH 1/4] Update Readme Update yaml file with new daemonset definition introduce by kubernetes 1.9 --- README.md | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/README.md b/README.md index 20ae8bda..fd823b52 100644 --- a/README.md +++ b/README.md @@ -127,6 +127,53 @@ spec: hostPath: path: /etc/localtime ``` + +For Kubernetes >= 1.9 you need to add selector tag as bellow: + +```yaml +apiVersion: extensions/v1beta1 +kind: DaemonSet +metadata: + name: node-problem-detector +spec: + selector: + matchLabels: + name: node-problem-detector + template: + metadata: + labels: + name: node-problem-detector + template: + spec: + containers: + - name: node-problem-detector + image: k8s.gcr.io/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 +``` + + * Edit node-problem-detector.yaml to fit your environment: Set `log` volume to your system log directory. (Used by SystemLogMonitor) * Create the DaemonSet with `kubectl create -f node-problem-detector.yaml` * If needed, you can use [ConfigMap](https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/) From f91ff6739237e3629ccee239316f9243142d845d Mon Sep 17 00:00:00 2001 From: Julien SENON Date: Sun, 25 Mar 2018 17:27:24 +0200 Subject: [PATCH 2/4] Change readme with remarks from @andyxning --- README.md | 84 +------------------ .../node-problem-detector-old.yaml | 0 deployment/node-problem-detector.yaml | 57 +++++++++++++ 3 files changed, 58 insertions(+), 83 deletions(-) rename node-problem-detector.yaml => deployment/node-problem-detector-old.yaml (100%) create mode 100644 deployment/node-problem-detector.yaml diff --git a/README.md b/README.md index fd823b52..7c2cc75c 100644 --- a/README.md +++ b/README.md @@ -91,89 +91,7 @@ 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: k8s.gcr.io/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 -``` - -For Kubernetes >= 1.9 you need to add selector tag as bellow: - -```yaml -apiVersion: extensions/v1beta1 -kind: DaemonSet -metadata: - name: node-problem-detector -spec: - selector: - matchLabels: - name: node-problem-detector - template: - metadata: - labels: - name: node-problem-detector - template: - spec: - containers: - - name: node-problem-detector - image: k8s.gcr.io/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 -``` - - +* Edit [node-problem-detector.yaml](https://github.com/kubernetes/node-problem-detector/blob/master/deployment/node-problem-detector.yaml) to fit your environment: Set `log` volume to your system log directory. (Used by SystemLogMonitor). For **kubernetes <=1.9** use [node-problem-detector-old.yaml](https://github.com/kubernetes/node-problem-detector/blob/master/deployment/node-problem-detector-old.yaml) * Edit node-problem-detector.yaml to fit your environment: Set `log` volume to your system log directory. (Used by SystemLogMonitor) * Create the DaemonSet with `kubectl create -f node-problem-detector.yaml` * If needed, you can use [ConfigMap](https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/) diff --git a/node-problem-detector.yaml b/deployment/node-problem-detector-old.yaml similarity index 100% rename from node-problem-detector.yaml rename to deployment/node-problem-detector-old.yaml diff --git a/deployment/node-problem-detector.yaml b/deployment/node-problem-detector.yaml new file mode 100644 index 00000000..95dcadc9 --- /dev/null +++ b/deployment/node-problem-detector.yaml @@ -0,0 +1,57 @@ +apiVersion: apps/v1 +kind: DaemonSet +metadata: + name: node-problem-detector +spec: + selector: + matchLabels: + name: node-problem-detector + template: + metadata: + labels: + app: node-problem-detector + spec: + containers: + - name: node-problem-detector + command: + - /node-problem-detector + - --logtostderr + - --kernel-monitor=/config/kernel-monitor.json + image: k8s.gcr.io/node-problem-detector:v0.2 + imagePullPolicy: Always + securityContext: + privileged: true + env: + - name: NODE_NAME + valueFrom: + fieldRef: + fieldPath: spec.nodeName + volumeMounts: + - 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 + mountPath: /etc/localtime + readOnly: true + - name: config + mountPath: /config + readOnly: true + volumes: + - name: log + # Config `log` to your system log directory + hostPath: + path: /var/log/ + - name: kmsg + hostPath: + path: /dev/kmsg + - name: localtime + hostPath: + path: /etc/localtime + - name: config + configMap: + name: node-problem-detector-config From 2758d5de488a4b9bc8ef08b86a14a02e53c85d09 Mon Sep 17 00:00:00 2001 From: Julien SENON Date: Sun, 25 Mar 2018 17:29:40 +0200 Subject: [PATCH 3/4] Change readme with remarks from @andyxning, remove duplicate comment --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index 7c2cc75c..74e0973f 100644 --- a/README.md +++ b/README.md @@ -92,7 +92,6 @@ to another registry. ## Start DaemonSet * Edit [node-problem-detector.yaml](https://github.com/kubernetes/node-problem-detector/blob/master/deployment/node-problem-detector.yaml) to fit your environment: Set `log` volume to your system log directory. (Used by SystemLogMonitor). For **kubernetes <=1.9** use [node-problem-detector-old.yaml](https://github.com/kubernetes/node-problem-detector/blob/master/deployment/node-problem-detector-old.yaml) -* Edit node-problem-detector.yaml to fit your environment: Set `log` volume to your system log directory. (Used by SystemLogMonitor) * Create the DaemonSet with `kubectl create -f node-problem-detector.yaml` * If needed, you can use [ConfigMap](https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/) to overwrite the `config/`. From a84a937de5242821f6d4764bf109e0c8299261fd Mon Sep 17 00:00:00 2001 From: Julien SENON Date: Sun, 25 Mar 2018 17:34:58 +0200 Subject: [PATCH 4/4] Change readme, fix <=1.9 to <1.9 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 74e0973f..813c7dc2 100644 --- a/README.md +++ b/README.md @@ -91,7 +91,7 @@ Run `make` in the top directory. It will: to another registry. ## Start DaemonSet -* Edit [node-problem-detector.yaml](https://github.com/kubernetes/node-problem-detector/blob/master/deployment/node-problem-detector.yaml) to fit your environment: Set `log` volume to your system log directory. (Used by SystemLogMonitor). For **kubernetes <=1.9** use [node-problem-detector-old.yaml](https://github.com/kubernetes/node-problem-detector/blob/master/deployment/node-problem-detector-old.yaml) +* Edit [node-problem-detector.yaml](https://github.com/kubernetes/node-problem-detector/blob/master/deployment/node-problem-detector.yaml) to fit your environment: Set `log` volume to your system log directory. (Used by SystemLogMonitor). For **kubernetes <1.9** use [node-problem-detector-old.yaml](https://github.com/kubernetes/node-problem-detector/blob/master/deployment/node-problem-detector-old.yaml) * Create the DaemonSet with `kubectl create -f node-problem-detector.yaml` * If needed, you can use [ConfigMap](https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/) to overwrite the `config/`.