clustersentinel

by chaser100

Helm chartv0.9.5App 0.9.5MITVerified publisher

Durable Kubernetes Event collector with Prometheus alerts, a Grafana dashboard, an HTTP API, and an embedded MCP server

About this chart

Cluster Sentinel

Cluster Sentinel watches Kubernetes core/v1 Events and keeps a queryable history after the pod restarts. It combines a durable SQLite event store, Prometheus metrics and alerts, a Grafana dashboard, an authenticated HTTP API, and an embedded Model Context Protocol server in one deployment.

Use it when an event may disappear from the Kubernetes API before an engineer or an automation agent investigates the incident. The collector stores each event together with its cluster identity and persists watch checkpoints, so a restart does not reset the investigation window or force an unsafe watch resume.

What the chart installs

ComponentDefaultPurpose
Cluster Sentinel DeploymentenabledLists and watches Kubernetes Events, writes SQLite, and serves HTTP on port 8080
PersistentVolumeClaimenabled, 5Gi, ReadWriteOnceStores event history and watch checkpoints in /var/lib/clustersentinel/events.db
ServiceAccount and cluster RBACenabledGrants read-only Event collection and Namespace discovery permissions
MCP authentication SecretenabledStores the Bearer token used by /mcp and /api/v1/events
Grafana dashboard ConfigMapenabledSupplies the bundled dashboard to a Grafana sidecar
ServiceMonitordisabledConfigures Prometheus Operator scraping for /metrics
PrometheusRuledisabledInstalls seven watch, storage, registry, and PVC alerts

The application is a statically linked MUSL binary running on distroless/static-debian13:nonroot. The runtime image does not contain OpenSSL, glibc, GCC runtime libraries, a package manager, or a shell. The container runs as UID 65532, drops all Linux capabilities, uses a read-only root filesystem, and writes only to the mounted data volume. The default Recreate deployment strategy and single replica prevent two processes from opening the same SQLite database.

Prerequisites

  • Kubernetes 1.23 or newer
  • Helm 3
  • a default StorageClass, or an explicit clustersentinel.persistentVolumeClaims[0].storageClassName
  • Prometheus Operator CRDs when enabling ServiceMonitor or PrometheusRule
  • a Grafana sidecar configured to discover ConfigMaps labeled grafana_dashboard: "1" when using the bundled dashboard

Install

helm repo add cluster-sentinel https://chaser100.github.io/cluster-sentinel
helm repo update

helm upgrade --install clustersentinel cluster-sentinel/clustersentinel \
  --version 0.9.5 \
  --namespace clustersentinel \
  --create-namespace

Check the rollout and the storage claim:

kubectl --namespace clustersentinel rollout status deployment/clustersentinel
kubectl --namespace clustersentinel get pods,pvc

The default installation generates an MCP token once and reuses it during Helm upgrades. Export it without printing it, then forward the Service from another terminal:

export CLUSTERSENTINEL_MCP_AUTH_TOKEN="$(
  kubectl --namespace clustersentinel get secret clustersentinel-mcp-auth \
    --output jsonpath='{.data.token}' | base64 --decode
)"

kubectl --namespace clustersentinel port-forward service/clustersentinel 8080:8080

Verify the public probes and authenticated event API:

curl --fail --silent http://127.0.0.1:8080/health | jq
curl --fail --silent http://127.0.0.1:8080/ready | jq
curl --fail --silent \
  --header "Authorization: Bearer ${CLUSTERSENTINEL_MCP_AUTH_TOKEN}" \
  "http://127.0.0.1:8080/api/v1/events?limit=20&type=Warning" | jq

Data flow and restart behavior

Kubernetes Events
       |
       v
list/watch -> bounded writer queue -> SQLite event + checkpoint transaction
                                         |
                    +--------------------+-------------------+
                    |                    |                   |
                    v                    v                   v
              HTTP event API         MCP tools       in-memory hot cache
                                                              |
                                                              v
                                                    Prometheus metrics

During the initial paginated list, Cluster Sentinel persists events first and commits the list snapshot checkpoint only after every page is durable. During watch processing, each event and its resource version are committed in one transaction before the in-memory cache is updated. On restart, the collector restores recent events from SQLite and resumes each watch scope from its last checkpoint.

Retention pruning runs at startup and every five minutes. It removes expired rows and then enforces the maximum row count in bounded transactions.

Persistent event storage

The default PVC has both helm.sh/resource-policy: keep and argocd.argoproj.io/sync-options: Prune=false. Helm uninstall and Argo CD pruning therefore leave the event database behind unless an operator deletes the claim explicitly.

Override capacity, StorageClass, cluster identity, or retention with values such as:

clustersentinel:
  persistentVolumeClaims:
    - name: clustersentinel-data
      size: 20Gi
      storageClassName: fast-ssd
      accessModes:
        - ReadWriteOnce
      mountPath: /var/lib/clustersentinel
      readOnly: false
      annotations:
        helm.sh/resource-policy: keep
        argocd.argoproj.io/sync-options: Prune=false

  env:
    - name: CLUSTERSENTINEL_STORAGE_PATH
      value: /var/lib/clustersentinel/events.db
    - name: CLUSTERSENTINEL_CLUSTER_ID
      value: production-eu-1
    - name: CLUSTERSENTINEL_STORAGE_RETENTION_SECS
      value: "1209600"
    - name: CLUSTERSENTINEL_STORAGE_MAX_EVENTS
      value: "500000"

Keep clustersentinel.replicaCount: 1 and clustersentinel.deploymentStrategy.type: Recreate when using SQLite on the default RWO claim. The pod security context sets fsGroup: 65532 and fsGroupChangePolicy: OnRootMismatch; the CSI driver must support Kubernetes volume ownership management or provision an equivalent writable directory.

For an intentionally ephemeral deployment:

clustersentinel:
  persistentVolumeClaims: []
  env:
    - name: CLUSTERSENTINEL_STORAGE_PATH
      value: memory

An ephemeral deployment loses events and checkpoints on every restart.

Prometheus and Grafana

Enable Prometheus Operator resources and set labels that match your Prometheus rule and ServiceMonitor selectors:

prometheusRule:
  enabled: true
  labels:
    release: kube-prometheus-stack

clustersentinel:
  serviceMonitor:
    enabled: true
    labels:
      release: kube-prometheus-stack

The dashboard ConfigMap is enabled by default. Change grafanaDashboard.labels when your Grafana sidecar uses another selector.

The bundled rules cover:

  • repeated Kubernetes watch failures and restarts;
  • an empty in-memory registry;
  • SQLite write errors and stalled writes;
  • stale watch checkpoints;
  • high filesystem usage on the Cluster Sentinel PVC.

/metrics includes Kubernetes object names and event message labels. Keep this endpoint inside the cluster and apply the same access controls used for other operational telemetry.

MCP and HTTP API

EndpointAuthenticationPurpose
/healthnoneProcess, watch, registry, and storage health details
/readynoneKubernetes readiness; fails when the collector or storage is not ready
/metricsnonePrometheus exposition endpoint
/api/v1/eventsBearer tokenFiltered, paginated event history from SQLite
/mcpBearer token and allowed HostStreamable HTTP MCP server

The MCP server provides health, recent-event, search, summary, single-event, and metrics-summary tools. Event search uses a stable versioned keyset cursor; deprecated decimal offsets remain accepted for older clients. See the complete MCP contract for tool schemas and client examples.

MCP validates the HTTP Host or :authority value to reduce DNS-rebinding risk. Add every externally used hostname to CLUSTERSENTINEL_MCP_ALLOWED_HOSTS. A valid Bearer token with an unlisted host still receives 403.

Use an existing Secret

Disable Secret management when Vault, External Secrets Operator, or another controller owns the token:

mcpAuth:
  manageSecret: false
  existingSecret: my-clustersentinel-token

clustersentinel:
  envSecrets:
    enableEnv: true
    envs:
      - name: CLUSTERSENTINEL_MCP_AUTH_TOKEN
        secretName: my-clustersentinel-token
        secretKey: token

The referenced key must contain a non-empty token. If you change mcpAuth.secretKey, change clustersentinel.envSecrets.envs[].secretKey to the same key.

Limit collection to selected namespaces

Set a comma-separated namespace allow-list. An empty value watches the entire cluster.

clustersentinel:
  env:
    - name: CLUSTERSENTINEL_NAMESPACES
      value: production,ingress-nginx
    - name: CLUSTERSENTINEL_CLUSTER_ID
      value: production-eu-1

The supplied ClusterRole remains cluster-wide and read-only. Set rbac.create: false and provide your own RBAC objects when the collector must not have permission outside those namespaces.

Expose the API

The Universal Helm Chart dependency supports Gateway API HTTPRoute and Ingress. Keep /metrics private. Expose /mcp and /api/v1/events only through a proxy that preserves the expected hostname and does not log the Authorization header.

Example HTTPRoute configuration:

clustersentinel:
  route:
    enabled: true
    spec:
      parentRefs:
        - name: external
          namespace: gateway-system
      hostnames:
        - clustersentinel.example.com
      rules:
        - matches:
            - path:
                type: Exact
                value: /health
            - path:
                type: Exact
                value: /ready
            - path:
                type: PathPrefix
                value: /mcp
            - path:
                type: PathPrefix
                value: /api/v1/events
          backendRefs:
            - name: clustersentinel
              port: 8080

  env:
    - name: CLUSTERSENTINEL_MCP_ALLOWED_HOSTS
      value: localhost,127.0.0.1,::1,clustersentinel,clustersentinel.example.com

Gateway API and Prometheus Operator CRDs are not installed by this chart.

Main values

ValueDefaultDescription
mcpAuth.manageSecrettrueCreate and retain the MCP Bearer Secret
mcpAuth.existingSecret""Use an externally managed Secret
mcpAuth.secretNameclustersentinel-mcp-authName of the managed or default referenced Secret
mcpAuth.secretKeytokenSecret data key containing the Bearer token
rbac.createtrueCreate cluster-wide read-only Event and Namespace permissions
grafanaDashboard.enabledtrueCreate the Grafana sidecar dashboard ConfigMap
grafanaDashboard.labelsgrafana_dashboard: "1"Labels used for dashboard discovery
prometheusRule.enabledfalseCreate the bundled PrometheusRule
prometheusRule.labelsrelease: kube-prometheus-stackLabels used by the Prometheus rule selector
clustersentinel.imagechaser420/cluster-sentinelContainer image repository
clustersentinel.imageTag0.9.5Container image tag; release tags match the chart version
clustersentinel.replicaCount1Replica count; keep one replica with the default SQLite database
clustersentinel.deploymentStrategy.typeRecreatePrevent concurrent access to the RWO SQLite volume during upgrades
clustersentinel.persistentVolumeClaimsclustersentinel-data, 5Gi, ReadWriteOnceCreate and mount durable SQLite storage
clustersentinel.readinessProbe.httpGet.path/readyRemove the pod from Service endpoints when durable storage is unavailable
clustersentinel.livenessProbe.httpGet.path/healthRestart a process whose health endpoint stops responding
clustersentinel.serviceMonitor.enabledfalseCreate a Prometheus Operator ServiceMonitor
clustersentinel.resources.requests50m, 128MiDefault CPU and memory requests
clustersentinel.resources.limits500m, 512MiDefault CPU and memory limits

clustersentinel is the alias of the bundled Universal Helm Chart dependency. Its workload, scheduling, Service, Ingress, Gateway API, ServiceMonitor, and security values remain available under this key. See the Universal Helm Chart values for additional options.

Runtime environment variables

VariableApplication defaultPurpose
CLUSTERSENTINEL_BIND0.0.0.0:8080HTTP listen address; the Service and probes must use the same port
CLUSTERSENTINEL_EVENTS_MODEkubernetesEvent source; kubernetes and k8s use the Kubernetes API, while demo generates test events
CLUSTERSENTINEL_LIST_LIMIT500Page size for the initial Kubernetes Events list
CLUSTERSENTINEL_WATCH_TIMEOUT_SECS290Kubernetes watch timeout; it must remain below the client limit of 295 seconds
CLUSTERSENTINEL_WATCH_BACKOFF_SECS5Initial retry delay after a list or watch failure
CLUSTERSENTINEL_WATCH_BACKOFF_MAX_SECS60Maximum exponential retry delay; must be at least the initial delay
CLUSTERSENTINEL_REGISTRY_CAPACITY10000Maximum deduplicated event objects retained in the in-memory hot cache
CLUSTERSENTINEL_DEDUP_TTL_SECS3600Inactivity period before an event leaves the in-memory cache
CLUSTERSENTINEL_METRICS_EVENT_LIMIT`5

Deploy clustersentinel with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has clustersentinel on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.

  1. Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
  2. Place the chartclustersentinel is pinned at v0.9.5 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
  3. ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below
opentenant validate opentenant.yaml
terraform init && terraform apply