From ad0e06c453fa07359c1d764039b44abf56d7c39c Mon Sep 17 00:00:00 2001 From: mickeyzzc Date: Thu, 23 Nov 2023 21:42:22 +0800 Subject: [PATCH] update readme ,track metrics for unassigned pods Signed-off-by: mickeyzzc --- README.md | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 9685543d34..77f2d16300 100644 --- a/README.md +++ b/README.md @@ -250,7 +250,7 @@ The downside of using an auto-sharded setup comes from the rollout strategy supp For pod metrics, they can be sharded per node with the following flag: -* `--node` +* `--node=$(NODE_NAME)` Each kube-state-metrics pod uses FieldSelector (spec.nodeName) to watch/list pod metrics only on the same node. @@ -276,6 +276,21 @@ spec: fieldPath: spec.nodeName ``` +To track metrics for unassigned pods, you need to add an additional deployment and set `--node=""`, as shown in the following example: +``` +apiVersion: apps/v1 +kind: Deployment +spec: + template: + spec: + containers: + - image: registry.k8s.io/kube-state-metrics/kube-state-metrics:IMAGE_TAG + name: kube-state-metrics + args: + - --resources=pods + - --node="" +``` + Other metrics can be sharded via [Horizontal sharding](#horizontal-sharding). ### Setup