diff --git a/helm/Makefile b/helm/Makefile new file mode 100644 index 0000000..8213868 --- /dev/null +++ b/helm/Makefile @@ -0,0 +1,55 @@ +# Makefile for kube-summary-exporter Helm chart + +CHART_NAME = kube-summary-exporter +RELEASE_NAME = kube-summary-exporter +NAMESPACE = monitoring + +.PHONY: lint template install upgrade uninstall package dry-run + +# Lint the Helm chart +lint: + helm lint $(CHART_NAME) + +# Render templates for debugging +template: + helm template $(RELEASE_NAME) $(CHART_NAME) --debug + +# Install the chart +install: + helm install $(RELEASE_NAME) $(CHART_NAME) --namespace $(NAMESPACE) --create-namespace + +# Upgrade the chart +upgrade: + helm upgrade $(RELEASE_NAME) $(CHART_NAME) --namespace $(NAMESPACE) + +# Uninstall the chart +uninstall: + helm uninstall $(RELEASE_NAME) --namespace $(NAMESPACE) + +# Package the chart +package: + helm package $(CHART_NAME) + +# Dry run installation +dry-run: + helm install $(RELEASE_NAME) $(CHART_NAME) --namespace $(NAMESPACE) --dry-run --debug + +# Show chart values +show-values: + helm show values $(CHART_NAME) + +# Show chart info +show-chart: + helm show chart $(CHART_NAME) + +# Test the release +test: + helm test $(RELEASE_NAME) --namespace $(NAMESPACE) + +# Get status +status: + helm status $(RELEASE_NAME) --namespace $(NAMESPACE) + +# List releases +list: + helm list --namespace $(NAMESPACE) \ No newline at end of file diff --git a/helm/README.md b/helm/README.md new file mode 100644 index 0000000..913a3cc --- /dev/null +++ b/helm/README.md @@ -0,0 +1,182 @@ +# Kube Summary Exporter Helm Chart + +This Helm chart deploys kube-summary-exporter on a Kubernetes cluster using the Helm package manager. + +## Prerequisites + +- Kubernetes 1.16+ +- Helm 3.0+ +- RBAC enabled cluster (for ServiceAccount and ClusterRole) + +## Installation + +From this directory: + +```bash +# Install the chart +helm install kube-summary-exporter ./kube-summary-exporter --namespace monitoring --create-namespace + +# Or use the Makefile +make install +``` + +## Configuration + +The following table lists the configurable parameters of the kube-summary-exporter chart and their default values. + +| Parameter | Description | Default | +|-----------|-------------|---------| +| `replicaCount` | Number of replicas | `1` | +| `image.repository` | Container image repository | `quay.io/utilitywarehouse/kube-summary-exporter` | +| `image.pullPolicy` | Container image pull policy | `IfNotPresent` | +| `image.tag` | Container image tag | `"latest"` | +| `service.type` | Kubernetes service type | `ClusterIP` | +| `service.port` | Service port | `9779` | +| `config.listenAddress` | Address to listen on for HTTP requests | `":9779"` | +| `config.kubeconfig` | Path to kubeconfig file (empty for in-cluster) | `""` | +| `rbac.create` | Create RBAC resources | `true` | +| `serviceAccount.create` | Create service account | `true` | +| `serviceMonitor.enabled` | Create ServiceMonitor for Prometheus Operator | `true` | +| `serviceMonitorNodes.enabled` | Create ServiceMonitor for /nodes endpoint | `true` | + +### ServiceMonitor Configuration + +The chart includes two ServiceMonitors for Prometheus Operator: + +1. **serviceMonitor**: Scrapes `/metrics` endpoint (exporter metrics) +2. **serviceMonitorNodes**: Scrapes `/nodes` endpoint (Kubernetes summary metrics) + +Both ServiceMonitors are configured with the label `release: kube-prom-stack` by default. Update `serviceMonitor.additionalLabels.release` to match your Prometheus Operator release name. + +## Usage Examples + +### Custom Values Installation + +Create a `values.yaml` file: + +```yaml +image: + tag: "v1.0.0" + +resources: + limits: + cpu: 100m + memory: 128Mi + requests: + cpu: 50m + memory: 64Mi + +serviceMonitor: + additionalLabels: + release: my-prometheus + +nodeSelector: + kubernetes.io/os: linux +``` + +Install with custom values: + +```bash +helm install kube-summary-exporter ./kube-summary-exporter -f values.yaml --namespace monitoring --create-namespace +``` + +### Disable ServiceMonitors + +If you don't use Prometheus Operator: + +```bash +helm install kube-summary-exporter ./kube-summary-exporter \ + --set serviceMonitor.enabled=false \ + --set serviceMonitorNodes.enabled=false \ + --namespace monitoring --create-namespace +``` + +## Accessing the Application + +After installation, you can access the kube-summary-exporter using port-forward: + +```bash +export POD_NAME=$(kubectl get pods --namespace monitoring -l "app.kubernetes.io/name=kube-summary-exporter" -o jsonpath="{.items[0].metadata.name}") +kubectl --namespace monitoring port-forward $POD_NAME 9779:9779 +``` + +Then visit: +- http://localhost:9779/ - Home page +- http://localhost:9779/nodes - Metrics for all nodes +- http://localhost:9779/node/{node-name} - Metrics for specific node +- http://localhost:9779/metrics - Exporter metrics + +## Available Commands (Makefile) + +From the helm directory, you can use: + +```bash +make lint # Lint the Helm chart +make template # Render templates for debugging +make install # Install the chart +make upgrade # Upgrade the chart +make uninstall # Uninstall the chart +make package # Package the chart +make dry-run # Dry run installation +make show-values # Show chart values +make show-chart # Show chart info +make test # Test the release +make status # Get release status +make list # List releases +``` + +## Troubleshooting + +### ServiceMonitor Not Picked Up + +If Prometheus isn't discovering your ServiceMonitor: + +1. Check your Prometheus serviceMonitorSelector labels: + ```bash + kubectl get prometheus -o yaml | grep -A 10 serviceMonitorSelector + ``` + +2. Ensure the `release` label matches your Prometheus release name: + ```yaml + serviceMonitor: + additionalLabels: + release: your-prometheus-release-name + ``` + +3. Verify namespace permissions and RBAC for Prometheus + +### Pod Not Starting + +Check the logs: +```bash +kubectl logs -n monitoring deployment/kube-summary-exporter +``` + +Common issues: +- RBAC permissions (check ServiceAccount and ClusterRole) +- Image pull issues (check imagePullSecrets) +- Resource constraints + +## Metrics Exposed + +The exporter provides detailed Kubernetes node and container metrics including: + +- Container logs filesystem usage +- Container rootfs usage +- Node runtime ImageFS usage +- Pod ephemeral storage usage + +See the [main README](../README.md) for a complete list of available metrics. + +## Development + +To contribute to this chart: + +1. Make changes to templates or values +2. Test with `helm template` and `helm lint` +3. Verify installation works in a test cluster +4. Update this README if adding new configuration options + +## License + +This chart is part of the kube-summary-exporter project. See the main repository for license information. \ No newline at end of file diff --git a/helm/kube-summary-exporter/Chart.yaml b/helm/kube-summary-exporter/Chart.yaml new file mode 100644 index 0000000..3739a7c --- /dev/null +++ b/helm/kube-summary-exporter/Chart.yaml @@ -0,0 +1,18 @@ +apiVersion: v2 +name: kube-summary-exporter +description: A Helm chart for kube-summary-exporter - Exports Prometheus metrics for the Kubernetes Summary API +type: application +version: 0.1.0 +appVersion: "latest" +keywords: + - kubernetes + - prometheus + - monitoring + - metrics + - summary-api +home: https://github.com/utilitywarehouse/kube-summary-exporter +sources: + - https://github.com/utilitywarehouse/kube-summary-exporter +maintainers: + - name: kube-summary-exporter + url: https://github.com/utilitywarehouse/kube-summary-exporter \ No newline at end of file diff --git a/helm/kube-summary-exporter/templates/NOTES.txt b/helm/kube-summary-exporter/templates/NOTES.txt new file mode 100644 index 0000000..11a5d92 --- /dev/null +++ b/helm/kube-summary-exporter/templates/NOTES.txt @@ -0,0 +1,39 @@ +1. Get the application URL by running these commands: +{{- if contains "NodePort" .Values.service.type }} + export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "kube-summary-exporter.fullname" . }}) + export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") + echo http://$NODE_IP:$NODE_PORT +{{- else if contains "LoadBalancer" .Values.service.type }} + NOTE: It may take a few minutes for the LoadBalancer IP to be available. + You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "kube-summary-exporter.fullname" . }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "kube-summary-exporter.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") + echo http://$SERVICE_IP:{{ .Values.service.port }} +{{- else if contains "ClusterIP" .Values.service.type }} + export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "kube-summary-exporter.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") + export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}") + echo "Visit http://127.0.0.1:9779 to use your application" + kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 9779:$CONTAINER_PORT +{{- end }} + +2. kube-summary-exporter provides the following endpoints: + - /: Home page with links to other endpoints + - /nodes: Metrics for all nodes in the cluster + - /node/{node}: Metrics for a specific node + - /metrics: Prometheus metrics about the exporter itself + +3. Example Prometheus scrape configuration: + Add the following to your Prometheus configuration to scrape metrics: + + - job_name: "kubernetes-summary" + kubernetes_sd_configs: + - role: node + relabel_configs: + - source_labels: [__meta_kubernetes_node_label_role] + action: replace + target_label: role + - source_labels: [__meta_kubernetes_node_name] + regex: (.+) + target_label: __metrics_path__ + replacement: /node/${1} + - target_label: __address__ + replacement: {{ include "kube-summary-exporter.fullname" . }}.{{ .Release.Namespace }}.svc.cluster.local:{{ .Values.service.port }} \ No newline at end of file diff --git a/helm/kube-summary-exporter/templates/_helpers.tpl b/helm/kube-summary-exporter/templates/_helpers.tpl new file mode 100644 index 0000000..06ad634 --- /dev/null +++ b/helm/kube-summary-exporter/templates/_helpers.tpl @@ -0,0 +1,62 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "kube-summary-exporter.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-summary-exporter.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 chart name and version as used by the chart label. +*/}} +{{- define "kube-summary-exporter.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "kube-summary-exporter.labels" -}} +helm.sh/chart: {{ include "kube-summary-exporter.chart" . }} +{{ include "kube-summary-exporter.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "kube-summary-exporter.selectorLabels" -}} +app.kubernetes.io/name: {{ include "kube-summary-exporter.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "kube-summary-exporter.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "kube-summary-exporter.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} \ No newline at end of file diff --git a/helm/kube-summary-exporter/templates/clusterrole.yaml b/helm/kube-summary-exporter/templates/clusterrole.yaml new file mode 100644 index 0000000..5fbe0af --- /dev/null +++ b/helm/kube-summary-exporter/templates/clusterrole.yaml @@ -0,0 +1,12 @@ +{{- if .Values.rbac.create -}} +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + name: {{ include "kube-summary-exporter.fullname" . }} + labels: + {{- include "kube-summary-exporter.labels" . | nindent 4 }} +rules: +{{- with .Values.rbac.rules }} + {{- toYaml . | nindent 2 }} +{{- end }} +{{- end }} \ No newline at end of file diff --git a/helm/kube-summary-exporter/templates/clusterrolebinding.yaml b/helm/kube-summary-exporter/templates/clusterrolebinding.yaml new file mode 100644 index 0000000..a437d8d --- /dev/null +++ b/helm/kube-summary-exporter/templates/clusterrolebinding.yaml @@ -0,0 +1,16 @@ +{{- if .Values.rbac.create -}} +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + name: {{ include "kube-summary-exporter.fullname" . }} + labels: + {{- include "kube-summary-exporter.labels" . | nindent 4 }} +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: {{ include "kube-summary-exporter.fullname" . }} +subjects: + - kind: ServiceAccount + name: {{ include "kube-summary-exporter.serviceAccountName" . }} + namespace: {{ .Release.Namespace }} +{{- end }} \ No newline at end of file diff --git a/helm/kube-summary-exporter/templates/deployment.yaml b/helm/kube-summary-exporter/templates/deployment.yaml new file mode 100644 index 0000000..f7a2f1f --- /dev/null +++ b/helm/kube-summary-exporter/templates/deployment.yaml @@ -0,0 +1,68 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "kube-summary-exporter.fullname" . }} + labels: + {{- include "kube-summary-exporter.labels" . | nindent 4 }} +spec: + replicas: {{ .Values.replicaCount }} + selector: + matchLabels: + {{- include "kube-summary-exporter.selectorLabels" . | nindent 6 }} + template: + metadata: + {{- with .Values.podAnnotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + {{- include "kube-summary-exporter.selectorLabels" . | nindent 8 }} + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + serviceAccountName: {{ include "kube-summary-exporter.serviceAccountName" . }} + securityContext: + {{- toYaml .Values.podSecurityContext | nindent 8 }} + containers: + - name: {{ .Chart.Name }} + securityContext: + {{- toYaml .Values.securityContext | nindent 12 }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + args: + - --listen-address={{ .Values.config.listenAddress }} + {{- if .Values.config.kubeconfig }} + - --kubeconfig={{ .Values.config.kubeconfig }} + {{- end }} + ports: + - name: http + containerPort: {{ .Values.service.targetPort }} + protocol: TCP + livenessProbe: + httpGet: + path: /metrics + port: http + initialDelaySeconds: 30 + periodSeconds: 10 + readinessProbe: + httpGet: + path: /metrics + port: http + initialDelaySeconds: 5 + periodSeconds: 5 + resources: + {{- toYaml .Values.resources | nindent 12 }} + {{- with .Values.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} \ No newline at end of file diff --git a/helm/kube-summary-exporter/templates/service.yaml b/helm/kube-summary-exporter/templates/service.yaml new file mode 100644 index 0000000..3c17107 --- /dev/null +++ b/helm/kube-summary-exporter/templates/service.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "kube-summary-exporter.fullname" . }} + labels: + {{- include "kube-summary-exporter.labels" . | nindent 4 }} +spec: + type: {{ .Values.service.type }} + ports: + - port: {{ .Values.service.port }} + targetPort: http + protocol: TCP + name: {{ .Values.service.name }} + selector: + {{- include "kube-summary-exporter.selectorLabels" . | nindent 4 }} \ No newline at end of file diff --git a/helm/kube-summary-exporter/templates/serviceaccount.yaml b/helm/kube-summary-exporter/templates/serviceaccount.yaml new file mode 100644 index 0000000..0246dd2 --- /dev/null +++ b/helm/kube-summary-exporter/templates/serviceaccount.yaml @@ -0,0 +1,12 @@ +{{- if .Values.serviceAccount.create -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ include "kube-summary-exporter.serviceAccountName" . }} + labels: + {{- include "kube-summary-exporter.labels" . | nindent 4 }} + {{- with .Values.serviceAccount.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +{{- end }} \ No newline at end of file diff --git a/helm/kube-summary-exporter/templates/servicemonitor-nodes.yaml b/helm/kube-summary-exporter/templates/servicemonitor-nodes.yaml new file mode 100644 index 0000000..3af33f0 --- /dev/null +++ b/helm/kube-summary-exporter/templates/servicemonitor-nodes.yaml @@ -0,0 +1,60 @@ +{{- if .Values.serviceMonitorNodes.enabled }} +apiVersion: monitoring.coreos.com/v1 +kind: ServiceMonitor +metadata: + name: {{ include "kube-summary-exporter.fullname" . }}-nodes + {{- if .Values.serviceMonitorNodes.namespace }} + namespace: {{ .Values.serviceMonitorNodes.namespace }} + {{- else }} + namespace: {{ .Release.Namespace }} + {{- end }} + labels: + {{- include "kube-summary-exporter.labels" . | nindent 4 }} + {{- with .Values.serviceMonitorNodes.additionalLabels }} + {{- toYaml . | nindent 4 }} + {{- end }} + {{- with .Values.serviceMonitorNodes.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + jobLabel: {{ .Values.serviceMonitorNodes.jobLabel | default "app.kubernetes.io/name" }} + selector: + matchLabels: + {{- include "kube-summary-exporter.selectorLabels" . | nindent 6 }} + {{- with .Values.serviceMonitorNodes.selector }} + {{- toYaml . | nindent 6 }} + {{- end }} + endpoints: + - port: {{ .Values.service.name }} + {{- with .Values.serviceMonitorNodes.interval }} + interval: {{ . }} + {{- end }} + {{- with .Values.serviceMonitorNodes.scrapeTimeout }} + scrapeTimeout: {{ . }} + {{- end }} + path: /nodes + {{- with .Values.serviceMonitorNodes.honorLabels }} + honorLabels: {{ . }} + {{- end }} + {{- with .Values.serviceMonitorNodes.metricRelabelings }} + metricRelabelings: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.serviceMonitorNodes.relabelings }} + relabelings: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.serviceMonitorNodes.targetLabels }} + targetLabels: + {{- toYaml . | nindent 4 }} + {{- end }} + {{- with .Values.serviceMonitorNodes.podTargetLabels }} + podTargetLabels: + {{- toYaml . | nindent 4 }} + {{- end }} + {{- with .Values.serviceMonitorNodes.namespaceSelector }} + namespaceSelector: + {{- toYaml . | nindent 4 }} + {{- end }} +{{- end }} \ No newline at end of file diff --git a/helm/kube-summary-exporter/templates/servicemonitor.yaml b/helm/kube-summary-exporter/templates/servicemonitor.yaml new file mode 100644 index 0000000..8b897ee --- /dev/null +++ b/helm/kube-summary-exporter/templates/servicemonitor.yaml @@ -0,0 +1,64 @@ +{{- if .Values.serviceMonitor.enabled }} +apiVersion: monitoring.coreos.com/v1 +kind: ServiceMonitor +metadata: + name: {{ include "kube-summary-exporter.fullname" . }} + {{- if .Values.serviceMonitor.namespace }} + namespace: {{ .Values.serviceMonitor.namespace }} + {{- else }} + namespace: {{ .Release.Namespace }} + {{- end }} + labels: + {{- include "kube-summary-exporter.labels" . | nindent 4 }} + {{- with .Values.serviceMonitor.additionalLabels }} + {{- toYaml . | nindent 4 }} + {{- end }} + {{- with .Values.serviceMonitor.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + jobLabel: {{ .Values.serviceMonitor.jobLabel | default "app.kubernetes.io/name" }} + selector: + matchLabels: + {{- include "kube-summary-exporter.selectorLabels" . | nindent 6 }} + {{- with .Values.serviceMonitor.selector }} + {{- toYaml . | nindent 6 }} + {{- end }} + endpoints: + - port: {{ .Values.service.name }} + {{- with .Values.serviceMonitor.interval }} + interval: {{ . }} + {{- end }} + {{- with .Values.serviceMonitor.scrapeTimeout }} + scrapeTimeout: {{ . }} + {{- end }} + {{- if .Values.serviceMonitor.path }} + path: {{ .Values.serviceMonitor.path }} + {{- else }} + path: /metrics + {{- end }} + {{- with .Values.serviceMonitor.honorLabels }} + honorLabels: {{ . }} + {{- end }} + {{- with .Values.serviceMonitor.metricRelabelings }} + metricRelabelings: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.serviceMonitor.relabelings }} + relabelings: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.serviceMonitor.targetLabels }} + targetLabels: + {{- toYaml . | nindent 4 }} + {{- end }} + {{- with .Values.serviceMonitor.podTargetLabels }} + podTargetLabels: + {{- toYaml . | nindent 4 }} + {{- end }} + {{- with .Values.serviceMonitor.namespaceSelector }} + namespaceSelector: + {{- toYaml . | nindent 4 }} + {{- end }} +{{- end }} \ No newline at end of file diff --git a/helm/kube-summary-exporter/values.yaml b/helm/kube-summary-exporter/values.yaml new file mode 100644 index 0000000..6395c6a --- /dev/null +++ b/helm/kube-summary-exporter/values.yaml @@ -0,0 +1,190 @@ +# Default values for kube-summary-exporter. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +replicaCount: 1 + +image: + repository: quay.io/utilitywarehouse/kube-summary-exporter + pullPolicy: IfNotPresent + # Overrides the image tag whose default is the chart appVersion. + tag: "latest" + +imagePullSecrets: [] +nameOverride: "" +fullnameOverride: "" + +serviceAccount: + # Specifies whether a service account should be created + create: true + # Annotations to add to the service account + annotations: {} + # The name of the service account to use. + # If not set and create is true, a name is generated using the fullname template + name: "" + +podAnnotations: {} + +podSecurityContext: {} + # fsGroup: 2000 + +securityContext: {} + # capabilities: + # drop: + # - ALL + # readOnlyRootFilesystem: true + # runAsNonRoot: true + # runAsUser: 1000 + +service: + type: ClusterIP + port: 9779 + targetPort: 9779 + name: kube-summary-exporter + +# Configuration for the kube-summary-exporter +config: + # The address to listen on for HTTP requests + listenAddress: ":9779" + # Path to a kubeconfig file (leave empty to use in-cluster config) + kubeconfig: "" + +resources: {} + # We usually recommend not to specify default resources and to leave this as a conscious + # choice for the user. This also increases chances charts run on environments with little + # resources, such as Minikube. If you do want to specify resources, uncomment the following + # lines, adjust them as necessary, and remove the curly braces after 'resources:'. + # limits: + # cpu: 100m + # memory: 128Mi + # requests: + # cpu: 100m + # memory: 128Mi + +nodeSelector: {} + +tolerations: [] + +affinity: {} + +# RBAC configuration +rbac: + # Specifies whether RBAC resources should be created + create: true + + # Rules for the ClusterRole + rules: + - apiGroups: [""] + resources: ["nodes"] + verbs: ["get", "list"] + - apiGroups: [""] + resources: ["nodes/proxy"] + verbs: ["get"] + +# ServiceMonitor configuration for Prometheus Operator +serviceMonitor: + # Specifies whether a ServiceMonitor should be created + enabled: true + + # TROUBLESHOOTING: If Prometheus isn't picking up your ServiceMonitor, check: + # 1. Your Prometheus serviceMonitorSelector labels (kubectl get prometheus -o yaml) + # 2. Ensure the 'release' label matches your Prometheus release name + # 3. Verify namespace permissions and RBAC + + # Namespace for the ServiceMonitor (defaults to release namespace) + namespace: "" + + # Additional labels for the ServiceMonitor + additionalLabels: + release: kube-prom-stack + + # Annotations for the ServiceMonitor + annotations: {} + + # Job label for the ServiceMonitor + jobLabel: "app.kubernetes.io/name" + + # Scraping interval + interval: 30s + + # Scrape timeout + scrapeTimeout: 10s + + # Metrics path (defaults to /metrics) + path: /metrics + + # Honor labels from the service + honorLabels: false + + # Additional selector labels + selector: {} + + # Target labels to add to scraped metrics + targetLabels: [] + + # Pod target labels to add to scraped metrics + podTargetLabels: [] + + # Namespace selector for the ServiceMonitor + namespaceSelector: {} + + # Metric relabelings + metricRelabelings: [] + # - sourceLabels: [__name__] + # regex: 'kube_summary_.*' + # action: keep + + # Relabelings + relabelings: [] + # - sourceLabels: [__meta_kubernetes_service_name] + # targetLabel: service + +# ServiceMonitor configuration for scraping /nodes endpoint (actual kube-summary data) +serviceMonitorNodes: + # Specifies whether a ServiceMonitor should be created for /nodes endpoint + enabled: true + + # Namespace for the ServiceMonitor (defaults to release namespace) + namespace: "" + + # Additional labels for the ServiceMonitor + additionalLabels: + release: kube-prom-stack + + # Annotations for the ServiceMonitor + annotations: {} + + # Job label for the ServiceMonitor + jobLabel: "app.kubernetes.io/name" + + # Scraping interval + interval: 30s + + # Scrape timeout + scrapeTimeout: 10s + + # Honor labels from the service + honorLabels: true + + # Additional selector labels + selector: {} + + # Target labels to add to scraped metrics + targetLabels: [] + + # Pod target labels to add to scraped metrics + podTargetLabels: [] + + # Namespace selector for the ServiceMonitor + namespaceSelector: {} + + # Metric relabelings + metricRelabelings: [] + # - sourceLabels: [__name__] + # regex: 'kube_summary_.*' + # action: keep + + # Relabelings + relabelings: [] + # - sourceLabels: [__meta_kubernetes_service_name] + # targetLabel: service \ No newline at end of file diff --git a/manifests/cluster/clusterrole.yaml b/manifests/cluster/clusterrole.yaml index d8d3274..b7f192e 100644 --- a/manifests/cluster/clusterrole.yaml +++ b/manifests/cluster/clusterrole.yaml @@ -3,6 +3,9 @@ kind: ClusterRole metadata: name: kube-summary-exporter rules: + - apiGroups: [""] + resources: ["nodes"] + verbs: ["get", "list"] - apiGroups: [""] resources: ["nodes/proxy"] verbs: ["get"]