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

Kubernetes Sealed Secrets Unparseable Decryption Sentinel

Audits Kubernetes SealedSecrets custom resources for unparseable decryption failures and certificate key mismatches, alerting SecOps teams on Slack.

Categories
CloudInfrastructure

Audits Bitnami SealedSecrets controller custom resources across Kubernetes namespaces to detect unparseable decryption failures, certificate key rotation mismatches, and corrupted ciphertexts before workload pods experience crash loops.

How it works

  1. Custom Object Discovery: Authenticates against the Kubernetes API server using kubeconfig secrets or ServiceAccount tokens to inspect bitnami.com/v1alpha1 SealedSecret objects.
  2. Condition Status Evaluation: Parses status conditions on every sealed secret, identifying resources where Type Synced equals False with decryption errors.
  3. Cryptographic Stall Classification: Evaluates failed secret counts against operational thresholds to determine whether key rotation or corruption is occurring.
  4. Incident Notification Dispatch: Dispatches formatted operational triage cards to Slack alerting SecOps with specific secret names and failure reasons.

Architecture diagram

flowchart TD
    A[periodic_sealed_secrets_audit Schedule Trigger] --> B[scan_sealed_secrets_status Python Script]
    B --> C[check_unparseable_secrets Flowable If]
    C -- Threshold Breached --> D[notify_slack_secops_alert Webhook]
    C -- Metrics Nominal --> E[log_nominal_secrets_state Log]
    D --> E
    E --> F[export_secrets_manifest Return]

Architecture components

  • Trigger (periodic_sealed_secrets_audit): Drives scheduled recurring surveillance cycles without human intervention.
  • Inspection Task (scan_sealed_secrets_status): Queries target APIs and structures diagnostic indicators via Kestra outputs.
  • Evaluation Gate (check_unparseable_secrets): Evaluates operational safety boundaries using deterministic boolean branching.
  • Notification Action (notify_slack_secops_alert): Dispatches rich, actionable incident messages directly to team channels.
  • Manifest Return (export_secrets_manifest): Emits structured compliance payloads for SIEM and analytics records.

Key capabilities

  • Automated Health Polling: Continuous scheduled surveillance executed on customizable recurring intervals without dedicated agent daemons.
  • Deterministic Threshold Evaluation: Pure boolean and numeric tolerance checks eliminating false positives and alert noise.
  • Contextual Incident Notification: Rich Slack messages populated with explicit resource identifiers, error reasons, and metrics.
  • Machine-Readable Audit Manifest: Structured execution telemetry exported for compliance archives, SIEM ingestion, or analytics dashboards.

What you get

  • Continuous automated surveillance of Bitnami SealedSecrets decryption status without manual kubectl logs inspection
  • Immediate discovery of private key rotation mismatches when secrets are encrypted with decommissioned cluster certificates
  • Prevention of widespread application deployment outages and CrashLoopBackOff states in production namespaces
  • Auditable structured telemetry manifest containing secret identifiers, failure conditions, and timestamps

Who it's for

  • Platform Engineers maintaining GitOps CI/CD pipelines deploying encrypted SealedSecrets into Kubernetes
  • DevSecOps Engineers accountable for secret management lifecycle compliance and key rotation hygiene
  • Site Reliability Engineers troubleshooting missing Kubernetes secret resources following deployments

Why orchestrate this with Kestra

  • Serverless execution environment querying Kubernetes custom resource endpoints without persistent daemon overhead
  • Centralized secret management securing cluster kubeconfig credentials within encrypted namespace vaults
  • Declarative Flowable branching logic directing execution between informational logging and urgent alerting
  • Automated audit trail generation recording historical secret decryption reliability for security reviews

Use cases

  • Certificate Rotation Verification: Verify that newly encrypted secrets successfully decrypt after rolling the SealedSecrets controller certificate.
  • GitOps Ingestion Auditing: Catch corrupt base64 ciphertexts committed into ArgoCD or Flux repositories before pods attempt startup.
  • Multi-Cluster Secret Sync Validation: Audit sealed secret synchronization across multi-region Kubernetes clusters from a single orchestrator.

Inputs

Name Type Default Description
namespace_filter STRING production Kubernetes namespace containing SealedSecret custom resources to audit.
max_error_age_minutes INT 30 Maximum tolerated duration in minutes a decryption failure state may persist before triggering alerts.
failure_threshold INT 1 Threshold count of failed or unparseable sealed secrets that triggers an automated alert.
alert_on_failure BOOL True Toggle whether Slack webhook alerts are dispatched upon detecting unparseable sealed secrets.

Expected outputs

  • {{ outputs.scan_sealed_secrets_status.vars.total_secrets }}: Total count of SealedSecret custom resources audited within the target namespace.
  • {{ outputs.scan_sealed_secrets_status.vars.failed_secrets_count }}: Count of sealed secrets exhibiting unparseable or failed decryption conditions.
  • {{ outputs.scan_sealed_secrets_status.vars.failed_secret_names }}: Comma-separated list of identified failing sealed secret resource names.
  • {{ outputs.scan_sealed_secrets_status.vars.failure_reasons }}: Concatenated error messages and condition reasons detailing why decryption halted.
  • {{ outputs.scan_sealed_secrets_status.vars.is_alerting }}: Boolean flag indicating whether failure count breached configured alert thresholds.

Prerequisites

  • Bitnami SealedSecrets controller deployed and active within the target Kubernetes cluster.
  • Kubernetes ServiceAccount with get, list, and watch permissions on sealedsecrets.bitnami.com custom resources.
  • Valid KUBECONFIG_DATA base64-encoded secret stored within Kestra namespace secret configuration.
  • Configured Slack incoming webhook URL with permissions to post messages into the designated alert channel.

Secrets

  • KUBECONFIG_DATA: Vault secret required for authenticated API execution and notifications.
  • SLACK_WEBHOOK_URL: Vault secret required for authenticated API execution and notifications.

Quick start

  1. Register required authentication credentials and webhook endpoints in Kestra namespace secrets.
  2. Import this blueprint into your Kestra instance under the company.security namespace.
  3. Review input defaults such as threshold limits, lookback windows, and alert toggles.
  4. Execute the flow manually to verify network connectivity, API permissions, and Slack notifications.
  5. Enable the automated schedule trigger to commence continuous background surveillance.

Common pitfalls and troubleshooting

  • Scope Attribute Mismatches: SealedSecrets support cluster-wide, namespace-wide, and strict scopes; scope mismatches produce unparseable decryption errors.
  • Controller Certificate Backup Loss: If the private key secret in kube-system is lost during cluster recovery, all existing sealed secrets become permanently unparseable.
  • Large Base64 Payloads: Ensure sealed secret YAML manifests do not truncate long base64 strings across line wraps causing corrupted RSA ciphertext blocks.
  • Transient Sync Delays: Allow the controller adequate time to decrypt newly applied secrets before treating pending conditions as permanent failures.

How to extend

  • Automated kubeseal Re-encryption: Trigger automated notification workflows prompting repository owners to re-encrypt secrets with the active public key.
  • Certificate Expiration Auditing: Add pre-emptive tasks checking the expiration date of the active SealedSecrets controller RSA certificate.
  • PagerDuty Escalation: Escalate to PagerDuty high-urgency incident pipelines if mission-critical database credentials fail decryption.

Links

See How

New to Kestra?

Use blueprints to kickstart your first workflows.