-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Forked `kube-state-metrics` v4.24.0 Helm chart - Added support for Daemonset that will capture metrics on a pod level. - Configured Deployment pod that will capture metrics for the rest of the resources.
- Loading branch information
Showing
20 changed files
with
1,418 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
apiVersion: v2 | ||
name: kube-state-metrics | ||
description: Install kube-state-metrics to generate and expose cluster-level metrics | ||
keywords: | ||
- metric | ||
- monitoring | ||
- prometheus | ||
- kubernetes | ||
type: application | ||
version: '4.24.0-logzio' | ||
appVersion: 2.7.0 | ||
home: https://github.com/kubernetes/kube-state-metrics/ | ||
sources: | ||
- https://github.com/kubernetes/kube-state-metrics/ | ||
maintainers: | ||
- name: ralongit | ||
email: [email protected] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
# Logz.io forked chart | ||
The `kube-state-metrics` helm chart was forked in order to divide the load of `pods` metrics collection by creating a daemonset with `daemonset.enabled` flag which is enabled by default. | ||
The rest of the resources metrics will be collected by the deployment pod. | ||
|
||
## Disable DaemonSet Pods Metrics Sharding | ||
|
||
```console | ||
helm install logzio-kube-state-metrics logzio-helm/kube-state-metrics --set daemonset.enabled=false | ||
``` | ||
|
||
Un-comment the `pods` metrics in the `collectors` configuraiton. | ||
|
||
# kube-state-metrics Helm Chart | ||
|
||
Installs the [kube-state-metrics agent](https://github.com/kubernetes/kube-state-metrics). | ||
|
||
|
||
## Get Repo Info | ||
|
||
```console | ||
helm repo add logzio-helm https://logzio.github.io/logzio-helm | ||
helm repo update | ||
``` | ||
|
||
_See [helm repo](https://helm.sh/docs/helm/helm_repo/) for command documentation._ | ||
|
||
## Install Chart | ||
|
||
```console | ||
helm install logzio-kube-state-metrics logzio-helm/kube-state-metrics [flags] | ||
``` | ||
|
||
_See [configuration](#configuration) below._ | ||
|
||
_See [helm install](https://helm.sh/docs/helm/helm_install/) for command documentation._ | ||
|
||
## Uninstall Chart | ||
|
||
```console | ||
helm uninstall logzio-kube-state-metrics | ||
``` | ||
|
||
This removes all the Kubernetes components associated with the chart and deletes the release. | ||
|
||
_See [helm uninstall](https://helm.sh/docs/helm/helm_uninstall/) for command documentation._ | ||
|
||
## Upgrading Chart | ||
|
||
```console | ||
helm upgrade logzio-kube-state-metrics logzio-helm/kube-state-metrics [flags] | ||
``` | ||
|
||
_See [helm upgrade](https://helm.sh/docs/helm/helm_upgrade/) for command documentation._ | ||
|
||
### Migrating from stable/kube-state-metrics and kubernetes/kube-state-metrics | ||
|
||
You can upgrade in-place: | ||
|
||
1. [get repo info](#get-repo-info) | ||
1. [upgrade](#upgrading-chart) your existing release name using the new chart repo | ||
|
||
|
||
## Upgrading to v3.0.0 | ||
|
||
v3.0.0 includes kube-state-metrics v2.0, see the [changelog](https://github.com/kubernetes/kube-state-metrics/blob/release-2.0/CHANGELOG.md) for major changes on the application-side. | ||
|
||
The upgraded chart now the following changes: | ||
* Dropped support for helm v2 (helm v3 or later is required) | ||
* collectors key was renamed to resources | ||
* namespace key was renamed to namespaces | ||
|
||
|
||
## Configuration | ||
|
||
See [Customizing the Chart Before Installing](https://helm.sh/docs/intro/using_helm/#customizing-the-chart-before-installing). To see all configurable options with detailed comments: | ||
|
||
```console | ||
helm show values logzio-helm/kube-state-metrics | ||
``` | ||
|
||
You may also run `helm show values` on this chart's [dependencies](#dependencies) for additional options. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
{{/* vim: set filetype=mustache: */}} | ||
{{/* | ||
Expand the name of the chart. | ||
*/}} | ||
{{- define "kube-state-metrics.name" -}} | ||
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} | ||
{{- end -}} | ||
|
||
{{/* | ||
Create a default fully qualified app name. | ||
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). | ||
If release name contains chart name it will be used as a full name. | ||
*/}} | ||
{{- define "kube-state-metrics.fullname" -}} | ||
{{- if .Values.fullnameOverride -}} | ||
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}} | ||
{{- else -}} | ||
{{- $name := default .Chart.Name .Values.nameOverride -}} | ||
{{- if contains $name .Release.Name -}} | ||
{{- .Release.Name | trunc 63 | trimSuffix "-" -}} | ||
{{- else -}} | ||
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} | ||
{{- end -}} | ||
{{- end -}} | ||
{{- end -}} | ||
|
||
{{/* | ||
Create the name of the service account to use | ||
*/}} | ||
{{- define "kube-state-metrics.serviceAccountName" -}} | ||
{{- if .Values.serviceAccount.create -}} | ||
{{ default (include "kube-state-metrics.fullname" .) .Values.serviceAccount.name }} | ||
{{- else -}} | ||
{{ default "default" .Values.serviceAccount.name }} | ||
{{- end -}} | ||
{{- end -}} | ||
|
||
{{/* | ||
Allow the release namespace to be overridden for multi-namespace deployments in combined charts | ||
*/}} | ||
{{- define "kube-state-metrics.namespace" -}} | ||
{{- if .Values.namespaceOverride -}} | ||
{{- .Values.namespaceOverride -}} | ||
{{- else -}} | ||
{{- .Release.Namespace -}} | ||
{{- end -}} | ||
{{- end -}} | ||
|
||
{{/* | ||
Create chart name and version as used by the chart label. | ||
*/}} | ||
{{- define "kube-state-metrics.chart" -}} | ||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} | ||
{{- end -}} | ||
|
||
{{/* | ||
Generate basic labels | ||
*/}} | ||
{{- define "kube-state-metrics.labels" }} | ||
helm.sh/chart: {{ template "kube-state-metrics.chart" . }} | ||
app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
app.kubernetes.io/component: metrics | ||
app.kubernetes.io/part-of: {{ template "kube-state-metrics.name" . }} | ||
{{- include "kube-state-metrics.selectorLabels" . }} | ||
{{- if .Chart.AppVersion }} | ||
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} | ||
{{- end }} | ||
{{- if .Values.customLabels }} | ||
{{ toYaml .Values.customLabels }} | ||
{{- end }} | ||
{{- if .Values.releaseLabel }} | ||
release: {{ .Release.Name }} | ||
{{- end }} | ||
{{- end }} | ||
|
||
{{/* | ||
Selector labels | ||
*/}} | ||
{{- define "kube-state-metrics.selectorLabels" }} | ||
app.kubernetes.io/name: {{ include "kube-state-metrics.name" . }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
{{- end }} | ||
|
||
{{/* Sets default scrape limits for servicemonitor */}} | ||
{{- define "servicemonitor.scrapeLimits" -}} | ||
{{- with .sampleLimit }} | ||
sampleLimit: {{ . }} | ||
{{- end }} | ||
{{- with .targetLimit }} | ||
targetLimit: {{ . }} | ||
{{- end }} | ||
{{- with .labelLimit }} | ||
labelLimit: {{ . }} | ||
{{- end }} | ||
{{- with .labelNameLengthLimit }} | ||
labelNameLengthLimit: {{ . }} | ||
{{- end }} | ||
{{- with .labelValueLengthLimit }} | ||
labelValueLengthLimit: {{ . }} | ||
{{- end }} | ||
{{- end -}} |
20 changes: 20 additions & 0 deletions
20
charts/kube-state-metrics/templates/clusterrolebinding.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{{- if and .Values.rbac.create .Values.rbac.useClusterRole -}} | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRoleBinding | ||
metadata: | ||
labels: | ||
{{- include "kube-state-metrics.labels" . | indent 4 }} | ||
name: {{ template "kube-state-metrics.fullname" . }} | ||
roleRef: | ||
apiGroup: rbac.authorization.k8s.io | ||
kind: ClusterRole | ||
{{- if .Values.rbac.useExistingRole }} | ||
name: {{ .Values.rbac.useExistingRole }} | ||
{{- else }} | ||
name: {{ template "kube-state-metrics.fullname" . }} | ||
{{- end }} | ||
subjects: | ||
- kind: ServiceAccount | ||
name: {{ template "kube-state-metrics.serviceAccountName" . }} | ||
namespace: {{ template "kube-state-metrics.namespace" . }} | ||
{{- end -}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,166 @@ | ||
{{- if .Values.daemonset.enabled }} | ||
apiVersion: apps/v1 | ||
kind: DaemonSet | ||
metadata: | ||
name: {{ template "kube-state-metrics.fullname" . }}-ds | ||
namespace: {{ template "kube-state-metrics.namespace" . }} | ||
labels: | ||
{{- include "kube-state-metrics.labels" . | indent 4 }} | ||
{{- if .Values.annotations }} | ||
annotations: | ||
{{ toYaml .Values.annotations | indent 4 }} | ||
{{- end }} | ||
spec: | ||
selector: | ||
matchLabels: | ||
{{- include "kube-state-metrics.selectorLabels" . | indent 6 }} | ||
{{- if .Values.autosharding.enabled }} | ||
serviceName: {{ template "kube-state-metrics.fullname" . }} | ||
volumeClaimTemplates: [] | ||
{{- end }} | ||
template: | ||
metadata: | ||
labels: | ||
{{- include "kube-state-metrics.labels" . | indent 8 }} | ||
{{- if .Values.podAnnotations }} | ||
annotations: | ||
{{ toYaml .Values.podAnnotations | indent 8 }} | ||
{{- end }} | ||
spec: | ||
hostNetwork: {{ .Values.hostNetwork }} | ||
serviceAccountName: {{ template "kube-state-metrics.serviceAccountName" . }} | ||
{{- if .Values.securityContext.enabled }} | ||
securityContext: {{- omit .Values.securityContext "enabled" | toYaml | nindent 8 }} | ||
{{- end }} | ||
{{- if .Values.priorityClassName }} | ||
priorityClassName: {{ .Values.priorityClassName }} | ||
{{- end }} | ||
containers: | ||
- name: {{ template "kube-state-metrics.name" . }} | ||
env: | ||
- name: NODE_NAME | ||
valueFrom: | ||
fieldRef: | ||
apiVersion: v1 | ||
fieldPath: spec.nodeName | ||
args: | ||
- --node=$(NODE_NAME) | ||
{{- if .Values.extraArgs }} | ||
{{- .Values.extraArgs | toYaml | nindent 8 }} | ||
{{- end }} | ||
{{- if .Values.service.port }} | ||
- --port={{ .Values.service.port | default 8080}} | ||
{{- end }} | ||
- --resources=pods | ||
{{- if .Values.metricLabelsAllowlist }} | ||
- --metric-labels-allowlist={{ .Values.metricLabelsAllowlist | join "," }} | ||
{{- end }} | ||
{{- if .Values.metricAnnotationsAllowList }} | ||
- --metric-annotations-allowlist={{ .Values.metricAnnotationsAllowList | join "," }} | ||
{{- end }} | ||
{{- if .Values.metricAllowlist }} | ||
- --metric-allowlist={{ .Values.metricAllowlist | join "," }} | ||
{{- end }} | ||
{{- if .Values.metricDenylist }} | ||
- --metric-denylist={{ .Values.metricDenylist | join "," }} | ||
{{- end }} | ||
{{- $namespaces := list }} | ||
{{- if .Values.namespaces }} | ||
{{- range $ns := join "," .Values.namespaces | split "," }} | ||
{{- $namespaces = append $namespaces (tpl $ns $) }} | ||
{{- end }} | ||
{{- end }} | ||
{{- if .Values.releaseNamespace }} | ||
{{- $namespaces = append $namespaces ( include "kube-state-metrics.namespace" . ) }} | ||
{{- end }} | ||
{{- if $namespaces }} | ||
- --namespaces={{ $namespaces | mustUniq | join "," }} | ||
{{- end }} | ||
{{- if .Values.namespacesDenylist }} | ||
- --namespaces-denylist={{ tpl (.Values.namespacesDenylist | join ",") $ }} | ||
{{- end }} | ||
{{- if .Values.kubeconfig.enabled }} | ||
- --kubeconfig=/opt/k8s/.kube/config | ||
{{- end }} | ||
{{- if .Values.selfMonitor.telemetryHost }} | ||
- --telemetry-host={{ .Values.selfMonitor.telemetryHost }} | ||
{{- end }} | ||
{{- if .Values.selfMonitor.telemetryPort }} | ||
- --telemetry-port={{ .Values.selfMonitor.telemetryPort | default 8081 }} | ||
{{- end }} | ||
{{- if or (.Values.kubeconfig.enabled) (.Values.volumeMounts) }} | ||
volumeMounts: | ||
{{- if .Values.kubeconfig.enabled }} | ||
- name: kubeconfig | ||
mountPath: /opt/k8s/.kube/ | ||
readOnly: true | ||
{{- end }} | ||
{{- if .Values.volumeMounts }} | ||
{{ toYaml .Values.volumeMounts | indent 8 }} | ||
{{- end }} | ||
{{- end }} | ||
imagePullPolicy: {{ .Values.image.pullPolicy }} | ||
{{- if .Values.image.sha }} | ||
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}@sha256:{{ .Values.image.sha }}" | ||
{{- else }} | ||
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" | ||
{{- end }} | ||
ports: | ||
- containerPort: {{ .Values.service.port | default 8080}} | ||
name: "http" | ||
{{- if .Values.selfMonitor.enabled }} | ||
- containerPort: {{ .Values.selfMonitor.telemetryPort | default 8081 }} | ||
name: "metrics" | ||
{{- end }} | ||
livenessProbe: | ||
httpGet: | ||
path: /healthz | ||
port: {{ .Values.service.port | default 8080}} | ||
initialDelaySeconds: 5 | ||
timeoutSeconds: 5 | ||
readinessProbe: | ||
httpGet: | ||
path: / | ||
port: {{ .Values.service.port | default 8080}} | ||
initialDelaySeconds: 5 | ||
timeoutSeconds: 5 | ||
{{- if .Values.resources }} | ||
resources: | ||
{{ toYaml .Values.resources | indent 10 }} | ||
{{- end }} | ||
{{- if .Values.containerSecurityContext }} | ||
securityContext: | ||
{{ toYaml .Values.containerSecurityContext | indent 10 }} | ||
{{- end }} | ||
{{- if .Values.imagePullSecrets }} | ||
imagePullSecrets: | ||
{{ toYaml .Values.imagePullSecrets | indent 8 }} | ||
{{- end }} | ||
{{- if .Values.affinity }} | ||
affinity: | ||
{{ toYaml .Values.affinity | indent 8 }} | ||
{{- end }} | ||
{{- if .Values.nodeSelector }} | ||
nodeSelector: | ||
{{ toYaml .Values.nodeSelector | indent 8 }} | ||
{{- end }} | ||
{{- if .Values.tolerations }} | ||
tolerations: | ||
{{ toYaml .Values.tolerations | indent 8 }} | ||
{{- end }} | ||
{{- if .Values.topologySpreadConstraints }} | ||
topologySpreadConstraints: | ||
{{ toYaml .Values.topologySpreadConstraints | indent 8 }} | ||
{{- end }} | ||
{{- if or (.Values.kubeconfig.enabled) (.Values.volumes) }} | ||
volumes: | ||
{{- if .Values.kubeconfig.enabled}} | ||
- name: kubeconfig | ||
secret: | ||
secretName: {{ template "kube-state-metrics.fullname" . }}-kubeconfig | ||
{{- end }} | ||
{{- if .Values.volumes }} | ||
{{ toYaml .Values.volumes | indent 8 }} | ||
{{- end }} | ||
{{- end }} | ||
{{- end }} |
Oops, something went wrong.