Skip to main content
Self-hosted Kubernetes customers own monitoring and alerting for their cluster and external dependencies (see Shared Responsibility). Runlayer maintains two reference Terraform modules (k8s-alerts/eks and k8s-alerts/gke) that give EKS and GKE deployments operational and security alert coverage aligned with Runlayer’s managed ECS fleet: Both modules read the structured JSON telemetry that Runlayer backend, worker, and consumer pods write to stdout (no OTEL collector sidecar or consent flag required). The one exception is database health on EKS, which the worker publishes with cloudwatch:PutMetricData (see the IAM permission section below).
The modules are not published to a module registry or download bucket yet. Ask Runlayer Support for the module source that matches your Runlayer release, unpack it next to your Terraform, and point source at the unpacked directory (the examples below assume ./modules/k8s-alerts/eks and ./modules/k8s-alerts/gke).
Each module also creates a heartbeat alarm per component group that pages when its timer-driven signal stops: audit-spool-no-data (the API spool tailer reports SpoolOldestAgeSeconds every 10 seconds, even when idle) and db-health-no-data (the worker’s database health job runs every 15 minutes). A heartbeat page means the telemetry path broke (log shipping, metric filters, IAM, LOG_LEVEL), so the other alarms in that group cannot see problems until it clears.

Amazon EKS (k8s-alerts/eks)

Why metric filters are required on EKS

Runlayer pods write single-line CloudWatch Embedded Metric Format (EMF) JSON to stdout. On EKS with the default amazon-cloudwatch-observability add-on (Fluent Bit), container stdout JSON is nested inside a log_processed field:
Because _aws is nested under log_processed instead of top-level, CloudWatch Logs does not extract EMF metrics automatically. By default (create_metric_filters = true), the EKS module creates aws_cloudwatch_log_metric_filter resources that extract $.log_processed.* into the exact Runlayer/* namespaces and dimension schemas expected by the alarms.
If your cluster uses a custom log shipper that emits raw top-level EMF into CloudWatch Logs, set create_metric_filters = false to avoid double-counting.

Terraform example (EKS)

Shared multi-tenant EKS clusters

CloudWatch Logs caps each log group at 100 metric filters. On a shared multi-tenant EKS cluster where multiple RunlayerInstance tenants log to the same /aws/containerinsights/<cluster>/application log group:
  1. Deploy one cluster-wide filter-only module instance with create_metric_filters = true, scope_metric_filters_to_customer_id = false, and create_alarms = false (enabling the union of component flags used on the cluster). Its filters emit metrics keyed dynamically by $.log_processed.CustomerId.
  2. Set create_metric_filters = false and a distinct name_prefix (for example the tenant name) on every per-tenant alarm module instance targeting that cluster, since alarm names are <name_prefix>-<alarm> and must be unique per account and region, and enable the optional component flags (for example enable_siem_export_alarms, enable_audit_consumer_alarms, enable_session_materializer_alarms) matching the components that tenant runs—optional flags default to false on tenant instances too. Leaving create_metric_filters = true on tenant instances alongside an unscoped filter instance publishes every matching log event twice and double-counts Sum/SampleCount metrics.

IAM permission for enable_db_health_alarms on EKS

Database health signals (InvalidIndexCount, AuditlogDefaultPartitionRows, PartmanMaintenanceFailedRuns, PartmanRunwayDays) are published by the worker via cloudwatch:PutMetricData rather than stdout EMF. Grant your worker IRSA role permission scoped to the Runlayer/DatabaseHealth namespace:

Google GKE (k8s-alerts/gke)

GKE’s Cloud Logging agent parses single-line stdout JSON directly into jsonPayload. The GKE module creates Cloud Logging user-defined metrics (google_logging_metric) scoped to your cluster, namespace, and CUSTOMER_ID, paired with google_monitoring_alert_policy resources.
  • Database health on GKE: the worker logs db_health_metrics_completed at INFO level with invalid_index_count, auditlog_default_rows, partman_failed_runs, and partman_runway_days on every 15-minute run even without AWS credentials, so enable_db_health_alarms = true works natively from Cloud Logging. Keep the worker at LOG_LEVEL=INFO (or DEBUG)—setting LOG_LEVEL=WARNING or higher suppresses db_health_metrics_completed and silences all four GKE database-health policies (db-health-no-data then pages). Unlike the fleet’s consecutive-period alarms, GKE counts breaching runs in a single jitter-tolerant window (2100s for 2 runs / 3000s for 3 runs) so 1s of cron jitter cannot reset the alert; this intentionally also pages on intermittent failures within that window (for example 1, 0, 1 at minutes 0, 15, 30).
  • SIEM export on GKE: audit-log-siem-export-failed alerts on gcs_upload, export_prepare, dead_letter, and organization_pin faults, audit-log-siem-export-orgrec alerts hourly on organization_record faults, and audit-log-siem-export-dead-letters alerts on per-record validate and enrich dead letters.
  • Confirming heartbeats armed on GKE: Cloud Monitoring only arms metric-absence policies (condition_absent) after the backing metric writes at least one point following policy creation or modification—unlike EKS (treat_missing_data = "breaching"), a misconfigured cluster_name, namespace_name, or customer_id filter will leave a heartbeat unarmed instead of paging. After applying or modifying the module, check Cloud Monitoring Metrics Explorer and confirm both logging.googleapis.com/user/<name_prefix>-audit-spool-no-data and logging.googleapis.com/user/<name_prefix>-db-health-no-data (allow up to 15 minutes for the first worker run) report datapoints.

Terraform example (GKE)

Alert coverage by component flag

Minimum backend release for spool loss and fallback alarms: audit-spool-dead-letters-pruned (SpoolDeadPruned) and audit-spool-fallback-sustained (SpoolFallback) filter on the backend emitter’s top-level Rollup: true EMF property so excluded reasons (such as retention_exported and spool_closed) stay owned by the backend. Both alarms need a backend image that emits Rollup: true, which ships in the same Runlayer release as these modules: use the module source Support gives you for your release, and ask Support if you are unsure whether your backend image is new enough. Against older backend images that do not emit Rollup, those two filters match no events and their notBreaching alarms stay silent even while every other alarm in the module functions normally.

Multi-org SIEM export reader scope (ReaderScope)

When components.siemExport.enabled is true, the Runlayer Operator automatically sets AUDIT_LOG_SIEM_EXPORT_DEPLOYED=true on the worker so ExportOrganizations is emitted hourly. By default, AUDIT_LOG_SIEM_EXPORT_READER_SCOPE is unset and reports ReaderScope=bucket, which causes audit-log-siem-export-multi-org-shared-readers and audit-log-siem-export-multi-org-batch-shared-readers to alert whenever more than one organization exports into the same bucket. To clear those alarms on a multi-org deployment:
  1. Either pin export to a single organization via AUDIT_LOG_SIEM_EXPORT_ORGANIZATION_ID, or
  2. Switch AUDIT_LOG_SIEM_EXPORT_KEY_LAYOUT=org_partitioned, verify every S3/GCS reader is restricted to a single organization_id=<uuid>/ prefix (never the bucket root), and then set AUDIT_LOG_SIEM_EXPORT_READER_SCOPE=organization via spec.extraEnv on your RunlayerInstance.

Operator deployment guide

Install the Runlayer Operator and configure components

Monitoring

Platform observability and alerting overview

Shared responsibility

Operational ownership split for self-hosted deployments

Workload identity

IRSA and GKE Workload Identity permissions