Script icon
Docker icon
If icon
SlackIncomingWebhook icon
Log icon
Return icon
Schedule icon

Polaris Workload Security Configuration and Score Audit Sentinel

Audits Fairwinds Polaris security metrics to detect Kubernetes workload score degradation, critical danger items, and root privileges.

Categories
CoreInfrastructure

Automates continuous security posture and workload configuration governance for Kubernetes clusters using Fairwinds Polaris.

How it works

  1. A schedule trigger executes the Polaris security audit workflow every 30 minutes.
  2. The Python task queries the Fairwinds Polaris dashboard Prometheus metrics endpoint on port 8080.
  3. The script extracts aggregate cluster security health scores, critical danger violations, and warning counts.
  4. An evaluation gate determines whether the cluster security score or danger violations breach operational tolerance bounds.
  5. When thresholds are breached, a high-priority Slack alert is dispatched to Kubernetes SecOps and platform SREs.
  6. When workload configurations comply with security benchmarks, nominal telemetry is logged.
  7. A structured JSON audit manifest is emitted for cloud compliance records, SOC 2 tracking, and security archives.

Architecture diagram

graph TD
    Trigger[Schedule Trigger: 30m] --> ScanMetrics[Python Script: Scrape Polaris Metrics]
    ScanMetrics --> EvalBreach{Score < Threshold OR Danger Items > 5?}
    EvalBreach -- Yes --> SlackAlert[Slack: High-Urgency SecOps Alert]
    EvalBreach -- No --> LogNominal[Log: Nominal Security State]
    SlackAlert --> EmitManifest[Debug Return: Polaris Audit Manifest]
    LogNominal --> EmitManifest

Architecture components

  • Trigger: Automated schedule polling at 30-minute intervals.
  • Script Task: Scrapes Polaris Prometheus telemetry endpoints using Docker container isolation.
  • Decision Gate: Evaluates whether cluster configuration scores or danger findings exceed safety limits.
  • Notification Task: Dispatches structured Slack alerts with cluster identity and score counts.
  • Audit Manifest: Emits JSON execution payloads containing workload security posture health and timestamps.

Key capabilities

  • Continuous surveillance of Kubernetes workload security configurations and Fairwinds Polaris cluster scores.
  • Immediate detection of dangerous privilege escalations (runAsRoot, hostNetwork, capabilities: SYS_ADMIN).
  • Tracking of missing resource limits and readiness/liveness probe misconfigurations across namespaces.
  • Zero external dependency execution via isolated containerized Python runners.

What you get

  • Preemptive alerting on container security posture degradation before unauthorized privileges are exploited.
  • Automated tracking of host namespace sharing and dangerous Linux capabilities across active workloads.
  • Real-time audit manifests capturing cluster workload security compliance for SOC 2 and ISO 27001.
  • Configurable tolerance thresholds adaptable to hardened production and flexible development environments.

Who it's for

  • Kubernetes SecOps Engineers ensuring developer workloads comply with hardening and CIS benchmarks.
  • Platform Engineering teams preventing insecure container manifests from reaching production clusters.
  • Compliance and Security Officers tracking SOC 2, HIPAA, and PCI-DSS container security compliance.
  • DevOps Leads diagnosing cluster security posture regressions and container configuration drift.

Why orchestrate this with Kestra

  • Deterministic Scheduling: Guarantees regular security audits without fragile local crontab scripts.
  • Containerized Runners: Runs Python tasks inside isolated Docker containers without host library dependencies.
  • Condition Branching: Flowable If tasks route alerts and nominal logging cleanly without spaghetti code.
  • Enterprise Secret Safety: Securely injects Slack webhook credentials without plain-text exposure.

Use cases

  • Privilege Escalation Detection: Alerts SecOps when a developer deploys a container with root execution or host namespaces.
  • Health Score Regression Tracking: Identifies when a wave of new deployments degrades the overall cluster security score.
  • Resource Limit Enforcement: Verifies that newly deployed microservices define CPU and memory limits to prevent OOM thrashing.
  • Continuous Security Governance: Feeds daily workload configuration health metrics into centralized compliance repositories.

Inputs

Name Type Default Description
polaris_dashboard_url STRING http://polaris-dashboard.polaris.svc.cluster.local:8080 Base HTTP URL exposing Polaris metrics.
target_cluster STRING production-workloads Target Kubernetes cluster under security surveillance.
min_health_score_threshold INT 85 Minimum acceptable Polaris health score (0-100).
max_danger_items_threshold INT 5 Maximum allowable critical security violations.
alert_on_any_danger BOOL false Whether any single critical violation triggers an alert.

Expected outputs

  • {{ outputs.scan_polaris_security_telemetry.vars.cluster_score }}: Aggregate Polaris cluster security score (0-100).
  • {{ outputs.scan_polaris_security_telemetry.vars.danger_items_count }}: Count of critical severity security violations.
  • {{ outputs.scan_polaris_security_telemetry.vars.warning_items_count }}: Count of warning level configuration issues.
  • {{ outputs.scan_polaris_security_telemetry.vars.workloads_audited_count }}: Total workloads evaluated in the cluster.
  • {{ outputs.scan_polaris_security_telemetry.vars.is_alerting }}: Boolean flag indicating security policy violation.
  • {{ outputs.emit_audit_manifest.value }}: Structured JSON audit manifest emitted for compliance archives.

Prerequisites

  • Fairwinds Polaris deployed in the cluster with Prometheus metrics enabled on port 8080.
  • Metrics port reachable from the Kestra worker execution environment.
  • Docker daemon running on the Kestra host to execute containerized Python tasks.

Secrets

  • SLACK_WEBHOOK_URL: Incoming webhook URL for the target Kubernetes SecOps Slack alerting channel.

Quick start

  1. Ensure Polaris service exposes port 8080 for Prometheus metrics scraping.
  2. Configure the SLACK_WEBHOOK_URL secret in your Kestra namespace settings.
  3. Specify your cluster identifier in target_cluster.
  4. Execute a manual test run via the Kestra UI to verify metric ingestion.
  5. Enable the periodic_polaris_audit trigger to establish automated continuous surveillance.

Common pitfalls and troubleshooting

  • Dashboard API Endpoint: Verify whether Polaris dashboard exposes /metrics or /api/v1/healthz depending on the chart version.
  • Namespace Exclusions: Ensure system namespaces (kube-system) are either scoped out or accounted for in the score calculation.
  • CRD RBAC Permissions: Polaris requires read access to Pods, Deployments, StatefulSets, and DaemonSets cluster-wide.
  • Custom Checks Configuration: If using custom Polaris checks, verify the syntax adheres to JSON schema specifications.

How to extend

  • Automated Admission Blocking: Chain an OPA Gatekeeper policy deployment task when security regressions persist.
  • Jira Issue Creation: Automatically open security remediation tickets for teams deploying privileged containers.
  • PagerDuty Escalation: Escalate to on-call security responders if critical danger items exceed 10 in production.

Links

See How

New to Kestra?

Use blueprints to kickstart your first workflows.