From c46e08e24f5c3c82ed4c1eaecc8d3fde002ce298 Mon Sep 17 00:00:00 2001 From: Pranshu Srivastava Date: Sat, 15 Jun 2024 00:53:14 +0530 Subject: [PATCH] fixup! fixup! enhancement: add `livez` endpoint Signed-off-by: Pranshu Srivastava --- README.md | 7 +++++++ README.md.tpl | 7 +++++++ examples/autosharding/statefulset.yaml | 2 +- examples/daemonsetsharding/daemonset.yaml | 2 +- examples/daemonsetsharding/deployment-no-node-pods.yaml | 2 +- examples/daemonsetsharding/deployment.yaml | 2 +- examples/standard/deployment.yaml | 2 +- jsonnet/kube-state-metrics/kube-state-metrics.libsonnet | 2 +- 8 files changed, 20 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index fbebaaf9fc..69061b623e 100644 --- a/README.md +++ b/README.md @@ -342,6 +342,13 @@ Note that your GCP identity is case sensitive but `gcloud info` as of Google Clo After running the above, if you see `Clusterrolebinding "cluster-admin-binding" created`, then you are able to continue with the setup of this service. +#### Probes + +The following probes are available, and follow the [Kubernetes best practices](https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#container-probes): + +* `livenessProbe`: Checks if the application is not affected by an outage, and is able to access the Kube API by querying the cluster's `/livez` endpoint. +* `readinessProbe`: Checks if the application is ready to serve metrics by querying its own telemetry metrics. + #### Limited privileges environment If you want to run kube-state-metrics in an environment where you don't have cluster-reader role, you can: diff --git a/README.md.tpl b/README.md.tpl index 932b186c12..ad28ae186e 100644 --- a/README.md.tpl +++ b/README.md.tpl @@ -343,6 +343,13 @@ Note that your GCP identity is case sensitive but `gcloud info` as of Google Clo After running the above, if you see `Clusterrolebinding "cluster-admin-binding" created`, then you are able to continue with the setup of this service. +#### Probes + +The following probes are available, and follow the [Kubernetes best practices](https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#container-probes): + +* `livenessProbe`: Checks if the application is not affected by an outage, and is able to access the Kube API by querying the cluster's `/livez` endpoint. +* `readinessProbe`: Checks if the application is ready to serve metrics by querying its own telemetry metrics. + #### Limited privileges environment If you want to run kube-state-metrics in an environment where you don't have cluster-reader role, you can: diff --git a/examples/autosharding/statefulset.yaml b/examples/autosharding/statefulset.yaml index 37dd37153f..cc12a09152 100644 --- a/examples/autosharding/statefulset.yaml +++ b/examples/autosharding/statefulset.yaml @@ -37,7 +37,7 @@ spec: image: registry.k8s.io/kube-state-metrics/kube-state-metrics:v2.12.0 livenessProbe: httpGet: - path: /healthz + path: /livez port: 8080 initialDelaySeconds: 5 timeoutSeconds: 5 diff --git a/examples/daemonsetsharding/daemonset.yaml b/examples/daemonsetsharding/daemonset.yaml index 7a4ea43d87..897a296848 100644 --- a/examples/daemonsetsharding/daemonset.yaml +++ b/examples/daemonsetsharding/daemonset.yaml @@ -32,7 +32,7 @@ spec: image: registry.k8s.io/kube-state-metrics/kube-state-metrics:v2.12.0 livenessProbe: httpGet: - path: /healthz + path: /livez port: 8080 initialDelaySeconds: 5 timeoutSeconds: 5 diff --git a/examples/daemonsetsharding/deployment-no-node-pods.yaml b/examples/daemonsetsharding/deployment-no-node-pods.yaml index a4b4032214..c5995a30d1 100644 --- a/examples/daemonsetsharding/deployment-no-node-pods.yaml +++ b/examples/daemonsetsharding/deployment-no-node-pods.yaml @@ -27,7 +27,7 @@ spec: image: registry.k8s.io/kube-state-metrics/kube-state-metrics:v2.12.0 livenessProbe: httpGet: - path: /healthz + path: /livez port: 8080 initialDelaySeconds: 5 timeoutSeconds: 5 diff --git a/examples/daemonsetsharding/deployment.yaml b/examples/daemonsetsharding/deployment.yaml index cbd6d7dd8d..2973ddc2fb 100644 --- a/examples/daemonsetsharding/deployment.yaml +++ b/examples/daemonsetsharding/deployment.yaml @@ -26,7 +26,7 @@ spec: image: registry.k8s.io/kube-state-metrics/kube-state-metrics:v2.12.0 livenessProbe: httpGet: - path: /healthz + path: /livez port: 8080 initialDelaySeconds: 5 timeoutSeconds: 5 diff --git a/examples/standard/deployment.yaml b/examples/standard/deployment.yaml index 85c3cec3e4..3f6ce8bc21 100644 --- a/examples/standard/deployment.yaml +++ b/examples/standard/deployment.yaml @@ -24,7 +24,7 @@ spec: - image: registry.k8s.io/kube-state-metrics/kube-state-metrics:v2.12.0 livenessProbe: httpGet: - path: /healthz + path: /livez port: 8080 initialDelaySeconds: 5 timeoutSeconds: 5 diff --git a/jsonnet/kube-state-metrics/kube-state-metrics.libsonnet b/jsonnet/kube-state-metrics/kube-state-metrics.libsonnet index a7c2904123..e392152dfe 100644 --- a/jsonnet/kube-state-metrics/kube-state-metrics.libsonnet +++ b/jsonnet/kube-state-metrics/kube-state-metrics.libsonnet @@ -193,7 +193,7 @@ }, livenessProbe: { timeoutSeconds: 5, initialDelaySeconds: 5, httpGet: { port: 8080, - path: '/healthz', + path: '/livez', } }, readinessProbe: { timeoutSeconds: 5, initialDelaySeconds: 5, httpGet: { port: 8081,