From 7fc7947bc3f83b70ea6614e04db4cd2aebe7ef87 Mon Sep 17 00:00:00 2001 From: JeffreyGuan Date: Mon, 15 May 2023 21:01:22 +0800 Subject: [PATCH] [fix] cannot patch resource "nodes/status" in API group --- README.md | 8 ++++++-- deployment/node-problem-detector.yaml | 1 + deployment/rbac.yaml | 19 +++++++++++++++++++ 3 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 deployment/rbac.yaml diff --git a/README.md b/README.md index f3d4b379..b27d4847 100644 --- a/README.md +++ b/README.md @@ -179,9 +179,13 @@ Alternatively, to install node-problem-detector manually: 2. Edit [node-problem-detector-config.yaml](deployment/node-problem-detector-config.yaml) to configure node-problem-detector. -3. Create the ConfigMap with `kubectl create -f node-problem-detector-config.yaml`. +3. Edit [rbac.yaml](deployment/rbac.yaml) to fit your environment. -3. Create the DaemonSet with `kubectl create -f node-problem-detector.yaml`. +4. Create the ServiceAccount and ClusterRoleBinding with `kubectl create -f rbac.yaml`. + +4. Create the ConfigMap with `kubectl create -f node-problem-detector-config.yaml`. + +5. Create the DaemonSet with `kubectl create -f node-problem-detector.yaml`. ## Start Standalone diff --git a/deployment/node-problem-detector.yaml b/deployment/node-problem-detector.yaml index a71c929d..47f42d9e 100644 --- a/deployment/node-problem-detector.yaml +++ b/deployment/node-problem-detector.yaml @@ -60,6 +60,7 @@ spec: - name: config mountPath: /config readOnly: true + serviceAccountName: node-problem-detector volumes: - name: log # Config `log` to your system log directory diff --git a/deployment/rbac.yaml b/deployment/rbac.yaml new file mode 100644 index 00000000..aed03662 --- /dev/null +++ b/deployment/rbac.yaml @@ -0,0 +1,19 @@ +apiVersion: v1 +kind: ServiceAccount +metadata: + name: node-problem-detector + namespace: kube-system + +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + name: npd-binding +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: system:node-problem-detector +subjects: + - kind: ServiceAccount + name: node-problem-detector + namespace: kube-system