-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(flux): add kube-state-metrics #2440
Merged
Merged
Conversation
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
Quality Gate passedKudos, no new issues were introduced! 0 New issues |
--- kubernetes/talos-flux/apps/observability/kube-prometheus-stack/app Kustomization: flux-system/apps-kube-prometheus-stack HelmRelease: observability/kube-prometheus-stack
+++ kubernetes/talos-flux/apps/observability/kube-prometheus-stack/app Kustomization: flux-system/apps-kube-prometheus-stack HelmRelease: observability/kube-prometheus-stack
@@ -36,19 +36,12 @@
coreDns:
enabled: true
fullnameOverride: prometheus
grafana:
enabled: false
forceDeployDashboards: true
- kube-state-metrics:
- fullnameOverride: kube-state-metrics
- prometheus:
- monitor:
- enabled: true
- selfMonitor:
- enabled: true
kubeApiServer:
enabled: true
kubeControllerManager:
enabled: false
endpoints:
- 192.168.1.51
@@ -113,8 +106,10 @@
- effect: NoSchedule
operator: Exists
valuesFrom:
- kind: ConfigMap
name: alertmanager-values-g449hk5h68
- kind: ConfigMap
+ name: kube-state-metrics-values-gfkcdkg4mt
+ - kind: ConfigMap
name: prometheus-values-8cbfbkckkc
--- kubernetes/talos-flux/apps/observability/kube-prometheus-stack/app Kustomization: flux-system/apps-kube-prometheus-stack ConfigMap: observability/kube-state-metrics-values-gfkcdkg4mt
+++ kubernetes/talos-flux/apps/observability/kube-prometheus-stack/app Kustomization: flux-system/apps-kube-prometheus-stack ConfigMap: observability/kube-state-metrics-values-gfkcdkg4mt
@@ -0,0 +1,299 @@
+---
+apiVersion: v1
+data:
+ values.yaml: |
+ ---
+ kube-state-metrics:
+ fullnameOverride: kube-state-metrics
+ metricLabelsAllowlist:
+ - pods=[*]
+ - deployments=[*]
+ - persistentvolumeclaims=[*]
+ selfMonitor:
+ enabled: true
+ prometheus:
+ monitor:
+ enabled: true
+ relabelings:
+ - action: replace
+ regex: (.*)
+ replacement: $1
+ sourceLabels:
+ - __meta_kubernetes_pod_node_name
+ targetLabel: kubernetes_node
+ rbac:
+ extraRules:
+ - apiGroups:
+ - source.toolkit.fluxcd.io
+ - kustomize.toolkit.fluxcd.io
+ - helm.toolkit.fluxcd.io
+ - notification.toolkit.fluxcd.io
+ - image.toolkit.fluxcd.io
+ resources:
+ - gitrepositories
+ - buckets
+ - helmrepositories
+ - helmcharts
+ - ocirepositories
+ - kustomizations
+ - helmreleases
+ - alerts
+ - providers
+ - receivers
+ - imagerepositories
+ - imagepolicies
+ - imageupdateautomations
+ verbs: ["list", "watch"]
+ customResourceState:
+ enabled: true
+ config:
+ spec:
+ resources:
+ - groupVersionKind:
+ group: kustomize.toolkit.fluxcd.io
+ version: v1
+ kind: Kustomization
+ metricNamePrefix: gotk
+ metrics:
+ - name: "resource_info"
+ help: "The current state of a GitOps Toolkit resource."
+ each:
+ type: Info
+ info:
+ labelsFromPath:
+ name: [metadata, name]
+ labelsFromPath:
+ exported_namespace: [metadata, namespace]
+ ready: [status, conditions, "[type=Ready]", status]
+ suspended: [spec, suspend]
+ revision: [status, lastAppliedRevision]
+ source_name: [spec, sourceRef, name]
+ - groupVersionKind:
+ group: helm.toolkit.fluxcd.io
+ version: v2beta2
+ kind: HelmRelease
+ metricNamePrefix: gotk
+ metrics:
+ - name: "resource_info"
+ help: "The current state of a GitOps Toolkit resource."
+ each:
+ type: Info
+ info:
+ labelsFromPath:
+ name: [metadata, name]
+ labelsFromPath:
+ exported_namespace: [metadata, namespace]
+ ready: [status, conditions, "[type=Ready]", status]
+ suspended: [spec, suspend]
+ revision: [status, lastAppliedRevision]
+ chart_name: [spec, chart, spec, chart]
+ chart_source_name: [spec, chart, spec, sourceRef, name]
+ - groupVersionKind:
+ group: source.toolkit.fluxcd.io
+ version: v1
+ kind: GitRepository
+ metricNamePrefix: gotk
+ metrics:
+ - name: "resource_info"
+ help: "The current state of a GitOps Toolkit resource."
+ each:
+ type: Info
+ info:
+ labelsFromPath:
+ name: [metadata, name]
+ labelsFromPath:
+ exported_namespace: [metadata, namespace]
+ ready: [status, conditions, "[type=Ready]", status]
+ suspended: [spec, suspend]
+ revision: [status, artifact, revision]
+ url: [spec, url]
+ - groupVersionKind:
+ group: source.toolkit.fluxcd.io
+ version: v1beta2
+ kind: Bucket
+ metricNamePrefix: gotk
+ metrics:
+ - name: "resource_info"
+ help: "The current state of a GitOps Toolkit resource."
+ each:
+ type: Info
+ info:
+ labelsFromPath:
+ name: [metadata, name]
+ labelsFromPath:
+ exported_namespace: [metadata, namespace]
+ ready: [status, conditions, "[type=Ready]", status]
+ suspended: [spec, suspend]
+ revision: [status, artifact, revision]
+ endpoint: [spec, endpoint]
+ bucket_name: [spec, bucketName]
+ - groupVersionKind:
+ group: source.toolkit.fluxcd.io
+ version: v1beta2
+ kind: HelmRepository
+ metricNamePrefix: gotk
+ metrics:
+ - name: "resource_info"
+ help: "The current state of a GitOps Toolkit resource."
+ each:
+ type: Info
+ info:
+ labelsFromPath:
+ name: [metadata, name]
+ labelsFromPath:
+ exported_namespace: [metadata, namespace]
+ ready: [status, conditions, "[type=Ready]", status]
+ suspended: [spec, suspend]
+ revision: [status, artifact, revision]
+ url: [spec, url]
+ - groupVersionKind:
+ group: source.toolkit.fluxcd.io
+ version: v1beta2
+ kind: HelmChart
+ metricNamePrefix: gotk
+ metrics:
+ - name: "resource_info"
+ help: "The current state of a GitOps Toolkit resource."
+ each:
+ type: Info
+ info:
+ labelsFromPath:
+ name: [metadata, name]
+ labelsFromPath:
+ exported_namespace: [metadata, namespace]
+ ready: [status, conditions, "[type=Ready]", status]
+ suspended: [spec, suspend]
+ revision: [status, artifact, revision]
+ chart_name: [spec, chart]
+ chart_version: [spec, version]
+ - groupVersionKind:
+ group: source.toolkit.fluxcd.io
+ version: v1beta2
+ kind: OCIRepository
+ metricNamePrefix: gotk
+ metrics:
+ - name: "resource_info"
+ help: "The current state of a GitOps Toolkit resource."
+ each:
+ type: Info
+ info:
+ labelsFromPath:
+ name: [metadata, name]
+ labelsFromPath:
+ exported_namespace: [metadata, namespace]
+ ready: [status, conditions, "[type=Ready]", status]
+ suspended: [spec, suspend]
+ revision: [status, artifact, revision]
+ url: [spec, url]
+ - groupVersionKind:
+ group: notification.toolkit.fluxcd.io
+ version: v1beta3
+ kind: Alert
+ metricNamePrefix: gotk
+ metrics:
+ - name: "resource_info"
+ help: "The current state of a GitOps Toolkit resource."
+ each:
+ type: Info
+ info:
+ labelsFromPath:
+ name: [metadata, name]
+ labelsFromPath:
+ exported_namespace: [metadata, namespace]
+ suspended: [spec, suspend]
+ - groupVersionKind:
+ group: notification.toolkit.fluxcd.io
+ version: v1beta3
+ kind: Provider
+ metricNamePrefix: gotk
+ metrics:
+ - name: "resource_info"
+ help: "The current state of a GitOps Toolkit resource."
+ each:
+ type: Info
+ info:
+ labelsFromPath:
+ name: [metadata, name]
+ labelsFromPath:
+ exported_namespace: [metadata, namespace]
+ suspended: [spec, suspend]
+ - groupVersionKind:
+ group: notification.toolkit.fluxcd.io
+ version: v1
+ kind: Receiver
+ metricNamePrefix: gotk
+ metrics:
+ - name: "resource_info"
+ help: "The current state of a GitOps Toolkit resource."
+ each:
+ type: Info
+ info:
+ labelsFromPath:
+ name: [metadata, name]
+ labelsFromPath:
+ exported_namespace: [metadata, namespace]
+ ready: [status, conditions, "[type=Ready]", status]
+ suspended: [spec, suspend]
+ webhook_path: [status, webhookPath]
[Diff truncated by flux-local] |
🦙 MegaLinter status: ✅ SUCCESS
See detailed report in MegaLinter reports MegaLinter is graciously provided by OX Security |
--- HelmRelease: observability/kube-prometheus-stack ClusterRole: observability/kube-state-metrics
+++ HelmRelease: observability/kube-prometheus-stack ClusterRole: observability/kube-state-metrics
@@ -208,7 +208,37 @@
- storage.k8s.io
resources:
- volumeattachments
verbs:
- list
- watch
+- apiGroups:
+ - apiextensions.k8s.io
+ resources:
+ - customresourcedefinitions
+ verbs:
+ - list
+ - watch
+- apiGroups:
+ - source.toolkit.fluxcd.io
+ - kustomize.toolkit.fluxcd.io
+ - helm.toolkit.fluxcd.io
+ - notification.toolkit.fluxcd.io
+ - image.toolkit.fluxcd.io
+ resources:
+ - gitrepositories
+ - buckets
+ - helmrepositories
+ - helmcharts
+ - ocirepositories
+ - kustomizations
+ - helmreleases
+ - alerts
+ - providers
+ - receivers
+ - imagerepositories
+ - imagepolicies
+ - imageupdateautomations
+ verbs:
+ - list
+ - watch
--- HelmRelease: observability/kube-prometheus-stack Deployment: observability/kube-state-metrics
+++ HelmRelease: observability/kube-prometheus-stack Deployment: observability/kube-state-metrics
@@ -41,12 +41,18 @@
type: RuntimeDefault
containers:
- name: kube-state-metrics
args:
- --port=8080
- --resources=certificatesigningrequests,configmaps,cronjobs,daemonsets,deployments,endpoints,horizontalpodautoscalers,ingresses,jobs,leases,limitranges,mutatingwebhookconfigurations,namespaces,networkpolicies,nodes,persistentvolumeclaims,persistentvolumes,poddisruptionbudgets,pods,replicasets,replicationcontrollers,resourcequotas,secrets,services,statefulsets,storageclasses,validatingwebhookconfigurations,volumeattachments
+ - --metric-labels-allowlist=pods=[*],deployments=[*],persistentvolumeclaims=[*]
+ - --custom-resource-state-config-file=/etc/customresourcestate/config.yaml
+ volumeMounts:
+ - name: customresourcestate-config
+ mountPath: /etc/customresourcestate
+ readOnly: true
imagePullPolicy: IfNotPresent
image: registry.k8s.io/kube-state-metrics/kube-state-metrics:v2.10.1
ports:
- containerPort: 8080
name: http
- containerPort: 8081
@@ -75,7 +81,11 @@
timeoutSeconds: 5
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL
+ volumes:
+ - name: customresourcestate-config
+ configMap:
+ name: kube-state-metrics-customresourcestate-config
--- HelmRelease: observability/kube-prometheus-stack ServiceMonitor: observability/kube-state-metrics
+++ HelmRelease: observability/kube-prometheus-stack ServiceMonitor: observability/kube-state-metrics
@@ -17,9 +17,23 @@
matchLabels:
app.kubernetes.io/name: kube-state-metrics
app.kubernetes.io/instance: kube-prometheus-stack
endpoints:
- port: http
honorLabels: true
+ relabelings:
+ - action: replace
+ regex: (.*)
+ replacement: $1
+ sourceLabels:
+ - __meta_kubernetes_pod_node_name
+ targetLabel: kubernetes_node
- port: metrics
honorLabels: true
+ relabelings:
+ - action: replace
+ regex: (.*)
+ replacement: $1
+ sourceLabels:
+ - __meta_kubernetes_pod_node_name
+ targetLabel: kubernetes_node
--- HelmRelease: observability/kube-prometheus-stack ConfigMap: observability/kube-state-metrics-customresourcestate-config
+++ HelmRelease: observability/kube-prometheus-stack ConfigMap: observability/kube-state-metrics-customresourcestate-config
@@ -0,0 +1,435 @@
+---
+apiVersion: v1
+kind: ConfigMap
+metadata:
+ name: kube-state-metrics-customresourcestate-config
+ namespace: observability
+ labels:
+ app.kubernetes.io/managed-by: Helm
+ app.kubernetes.io/component: metrics
+ app.kubernetes.io/part-of: kube-state-metrics
+ app.kubernetes.io/name: kube-state-metrics
+ app.kubernetes.io/instance: kube-prometheus-stack
+ release: kube-prometheus-stack
+data:
+ config.yaml: |
+ spec:
+ resources:
+ - groupVersionKind:
+ group: kustomize.toolkit.fluxcd.io
+ kind: Kustomization
+ version: v1
+ metricNamePrefix: gotk
+ metrics:
+ - each:
+ info:
+ labelsFromPath:
+ name:
+ - metadata
+ - name
+ type: Info
+ help: The current state of a GitOps Toolkit resource.
+ labelsFromPath:
+ exported_namespace:
+ - metadata
+ - namespace
+ ready:
+ - status
+ - conditions
+ - '[type=Ready]'
+ - status
+ revision:
+ - status
+ - lastAppliedRevision
+ source_name:
+ - spec
+ - sourceRef
+ - name
+ suspended:
+ - spec
+ - suspend
+ name: resource_info
+ - groupVersionKind:
+ group: helm.toolkit.fluxcd.io
+ kind: HelmRelease
+ version: v2beta2
+ metricNamePrefix: gotk
+ metrics:
+ - each:
+ info:
+ labelsFromPath:
+ name:
+ - metadata
+ - name
+ type: Info
+ help: The current state of a GitOps Toolkit resource.
+ labelsFromPath:
+ chart_name:
+ - spec
+ - chart
+ - spec
+ - chart
+ chart_source_name:
+ - spec
+ - chart
+ - spec
+ - sourceRef
+ - name
+ exported_namespace:
+ - metadata
+ - namespace
+ ready:
+ - status
+ - conditions
+ - '[type=Ready]'
+ - status
+ revision:
+ - status
+ - lastAppliedRevision
+ suspended:
+ - spec
+ - suspend
+ name: resource_info
+ - groupVersionKind:
+ group: source.toolkit.fluxcd.io
+ kind: GitRepository
+ version: v1
+ metricNamePrefix: gotk
+ metrics:
+ - each:
+ info:
+ labelsFromPath:
+ name:
+ - metadata
+ - name
+ type: Info
+ help: The current state of a GitOps Toolkit resource.
+ labelsFromPath:
+ exported_namespace:
+ - metadata
+ - namespace
+ ready:
+ - status
+ - conditions
+ - '[type=Ready]'
+ - status
+ revision:
+ - status
+ - artifact
+ - revision
+ suspended:
+ - spec
+ - suspend
+ url:
+ - spec
+ - url
+ name: resource_info
+ - groupVersionKind:
+ group: source.toolkit.fluxcd.io
+ kind: Bucket
+ version: v1beta2
+ metricNamePrefix: gotk
+ metrics:
+ - each:
+ info:
+ labelsFromPath:
+ name:
+ - metadata
+ - name
+ type: Info
+ help: The current state of a GitOps Toolkit resource.
+ labelsFromPath:
+ bucket_name:
+ - spec
+ - bucketName
+ endpoint:
+ - spec
+ - endpoint
+ exported_namespace:
+ - metadata
+ - namespace
+ ready:
+ - status
+ - conditions
+ - '[type=Ready]'
+ - status
+ revision:
+ - status
+ - artifact
+ - revision
+ suspended:
+ - spec
+ - suspend
+ name: resource_info
+ - groupVersionKind:
+ group: source.toolkit.fluxcd.io
+ kind: HelmRepository
+ version: v1beta2
+ metricNamePrefix: gotk
+ metrics:
+ - each:
+ info:
+ labelsFromPath:
+ name:
+ - metadata
+ - name
+ type: Info
+ help: The current state of a GitOps Toolkit resource.
+ labelsFromPath:
+ exported_namespace:
+ - metadata
+ - namespace
+ ready:
+ - status
+ - conditions
+ - '[type=Ready]'
+ - status
+ revision:
+ - status
+ - artifact
+ - revision
+ suspended:
+ - spec
+ - suspend
+ url:
+ - spec
+ - url
+ name: resource_info
+ - groupVersionKind:
+ group: source.toolkit.fluxcd.io
+ kind: HelmChart
+ version: v1beta2
+ metricNamePrefix: gotk
+ metrics:
+ - each:
+ info:
+ labelsFromPath:
+ name:
+ - metadata
+ - name
+ type: Info
+ help: The current state of a GitOps Toolkit resource.
+ labelsFromPath:
+ chart_name:
+ - spec
+ - chart
+ chart_version:
+ - spec
+ - version
+ exported_namespace:
+ - metadata
+ - namespace
+ ready:
+ - status
+ - conditions
+ - '[type=Ready]'
+ - status
+ revision:
+ - status
+ - artifact
+ - revision
+ suspended:
+ - spec
+ - suspend
+ name: resource_info
+ - groupVersionKind:
+ group: source.toolkit.fluxcd.io
+ kind: OCIRepository
+ version: v1beta2
+ metricNamePrefix: gotk
+ metrics:
+ - each:
+ info:
+ labelsFromPath:
+ name:
+ - metadata
+ - name
+ type: Info
+ help: The current state of a GitOps Toolkit resource.
+ labelsFromPath:
+ exported_namespace:
+ - metadata
+ - namespace
+ ready:
+ - status
+ - conditions
+ - '[type=Ready]'
+ - status
+ revision:
+ - status
+ - artifact
+ - revision
+ suspended:
+ - spec
+ - suspend
+ url:
+ - spec
+ - url
+ name: resource_info
+ - groupVersionKind:
+ group: notification.toolkit.fluxcd.io
+ kind: Alert
+ version: v1beta3
+ metricNamePrefix: gotk
+ metrics:
+ - each:
+ info:
+ labelsFromPath:
+ name:
+ - metadata
+ - name
+ type: Info
+ help: The current state of a GitOps Toolkit resource.
+ labelsFromPath:
+ exported_namespace:
+ - metadata
+ - namespace
+ suspended:
+ - spec
+ - suspend
+ name: resource_info
+ - groupVersionKind:
+ group: notification.toolkit.fluxcd.io
+ kind: Provider
+ version: v1beta3
+ metricNamePrefix: gotk
+ metrics:
+ - each:
+ info:
+ labelsFromPath:
+ name:
+ - metadata
+ - name
+ type: Info
+ help: The current state of a GitOps Toolkit resource.
+ labelsFromPath:
+ exported_namespace:
+ - metadata
+ - namespace
+ suspended:
+ - spec
+ - suspend
+ name: resource_info
+ - groupVersionKind:
+ group: notification.toolkit.fluxcd.io
+ kind: Receiver
+ version: v1
+ metricNamePrefix: gotk
+ metrics:
+ - each:
+ info:
+ labelsFromPath:
+ name:
+ - metadata
+ - name
+ type: Info
+ help: The current state of a GitOps Toolkit resource.
+ labelsFromPath:
+ exported_namespace:
+ - metadata
+ - namespace
+ ready:
+ - status
+ - conditions
+ - '[type=Ready]'
+ - status
+ suspended:
+ - spec
+ - suspend
+ webhook_path:
+ - status
+ - webhookPath
+ name: resource_info
+ - groupVersionKind:
+ group: image.toolkit.fluxcd.io
+ kind: ImageRepository
+ version: v1beta2
+ metricNamePrefix: gotk
+ metrics:
+ - each:
+ info:
+ labelsFromPath:
+ name:
+ - metadata
+ - name
+ type: Info
+ help: The current state of a GitOps Toolkit resource.
+ labelsFromPath:
+ exported_namespace:
+ - metadata
+ - namespace
+ image:
+ - spec
+ - image
+ ready:
+ - status
+ - conditions
+ - '[type=Ready]'
+ - status
+ suspended:
+ - spec
+ - suspend
+ name: resource_info
+ - groupVersionKind:
+ group: image.toolkit.fluxcd.io
+ kind: ImagePolicy
+ version: v1beta2
+ metricNamePrefix: gotk
+ metrics:
+ - each:
+ info:
+ labelsFromPath:
[Diff truncated by flux-local] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.