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

Linkerd Service Mesh TLS Identity Expiration and Route Sentinel

Scrapes Linkerd Prometheus metrics to track mTLS identity certificate expiration, trust anchor validity, and proxy injection with Slack alerting.

Categories
CloudInfrastructure

Production-grade service mesh security watchdog that continuously monitors Linkerd control plane instances. It tracks days remaining before mTLS identity certificate and trust anchor root expiration, monitors route failure rates across meshed microservices, detects unmeshed workload pod dropouts, and triggers structured Slack alerts before cryptographic expiration breaks inter-service communication across the Kubernetes cluster.

How it works

  1. A recurring schedule trigger wakes the flow every 15 minutes to initiate Linkerd service mesh surveillance.
  2. A containerized Python script polls the Linkerd destination controller Prometheus metrics endpoint.
  3. The script calculates days until expiration for both identity issuer certificates and trust anchor roots.
  4. The script audits meshed pod counts and identifies unmeshed pods that fail sidecar proxy injection.
  5. A decision gate evaluates whether certificate validity windows or route failure rates breach security policies.
  6. When expiration windows narrow, high-priority notifications dispatch to Security SRE channels with renewal runbooks.
  7. A structured audit manifest is emitted for enterprise compliance records and cryptographic mesh archives.

Architecture diagram

flowchart TD
    A[Schedule Trigger: Every 15 Mins] --> B[scan_linkerd_mesh_metrics]
    B --> C{evaluate_linkerd_threshold}
    C -- Alert Triggered --> D[notify_slack_security_team]
    C -- Nominal State --> E[log_nominal_linkerd_state]
    D --> F[emit_audit_manifest]
    E --> F[emit_audit_manifest]

Architecture components

  • Trigger (periodic_linkerd_audit): Recurring cron schedule executing every 15 minutes for proactive mesh surveillance.
  • Scraper Task (scan_linkerd_mesh_metrics): Docker-isolated Python script polling Linkerd metrics with error handling.
  • Decision Gate (evaluate_linkerd_threshold): Evaluates certificate expiration days and route failure rates against thresholds.
  • Notification Task (notify_slack_security_team): Sends rich Slack alert with certificate days, pod counts, and runbooks.
  • Compliance Manifest (emit_audit_manifest): Emits structured JSON summary for security audit archives.

Key capabilities

  • Continuous surveillance of mTLS identity issuer and trust anchor certificate expiration timelines.
  • Early warning before automatic Cert-Manager certificate renewal failures lock out mesh proxies.
  • Detection of unmeshed pods operating without mutual TLS encryption in secure namespaces.
  • Standardized Slack alerting with operational runbook instructions for security administrators.

What you get

  • Real-time visibility into Linkerd service mesh cryptographic health and TLS certificate lifecycles.
  • Protection against cluster-wide microservice communication blackouts caused by expired mesh CAs.
  • Automated Slack incident notifications with remaining days, pod counts, and remediation advice.
  • Clean compliance manifests recording service mesh security statuses for SOC 2 and FedRAMP audit trails.

Who it's for

  • Platform Security Engineers managing enterprise Kubernetes service mesh infrastructures.
  • Site Reliability Engineers safeguarding zero-trust mTLS inter-service encryption.
  • Cloud Infrastructure Engineers operating automated TLS certificate issuers and cert-manager controllers.
  • DevSecOps Teams maintaining continuous compliance and pod admission encryption standards.

Why orchestrate this with Kestra

  • Decoupled Architecture: Scrapes metrics externally without requiring root access to Linkerd control plane nodes.
  • Deterministic Scheduling: Native cron scheduling ensures consistent surveillance without cron daemon drift.
  • Isolated Execution: Runs Python scrapers inside isolated Docker containers with pre-installed libraries.
  • Enterprise Auditability: Generates structured execution histories and JSON manifests for regulatory reporting.

Use cases

  • Trust Anchor Rotation Tracking: Ensure manual trust anchor rotation is initiated months before root expiry.
  • Cert-Manager Failure Detection: Catch issuer secret sync errors before proxy identity certificates expire.
  • Namespace Onboarding Validation: Verify that 100% of newly deployed application pods receive sidecar injection.
  • Disaster Recovery Auditing: Validate secondary Kubernetes cluster mesh certificates following cluster replication.

Inputs

Name Type Default Description
linkerd_metrics_url STRING http://linkerd-destination.linkerd.svc.cluster.local:9990 Base HTTP URL exposing Linkerd controller Prometheus metrics.
mesh_namespace STRING production-workloads Target Kubernetes namespace under active mesh surveillance.
min_certificate_days_threshold INT 30 Minimum allowable days remaining before certificate expiry before alerting.
lookback_minutes INT 15 Lookback evaluation window in minutes for mesh telemetry.
alert_on_linkerd_failures BOOL true Toggle Slack alert dispatch upon detecting expiring certs or route dropouts.

Expected outputs

  • {{ outputs.scan_linkerd_mesh_metrics.vars.identity_cert_days_remaining }}: Days remaining before mTLS identity certificate expiry.
  • {{ outputs.scan_linkerd_mesh_metrics.vars.trust_anchor_days_remaining }}: Days remaining before trust anchor root CA expiry.
  • {{ outputs.scan_linkerd_mesh_metrics.vars.meshed_pods_count }}: Count of active pods running with Linkerd proxy sidecar.
  • {{ outputs.scan_linkerd_mesh_metrics.vars.unmeshed_pods_count }}: Count of unmeshed pods lacking mutual TLS encryption.
  • {{ outputs.scan_linkerd_mesh_metrics.vars.is_alerting }}: Boolean flag indicating whether failure thresholds were breached.
  • {{ outputs.emit_audit_manifest.value }}: Structured JSON audit manifest emitted for compliance archives.

Prerequisites

  • Kubernetes cluster deployed with Linkerd 2.x and metrics enabled on destination controller.
  • Controller metrics port 9990 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 Security SRE Slack alerting channel.

Quick start

  1. Ensure Linkerd destination service exposes Prometheus metrics port 9990 to worker pods.
  2. Configure the SLACK_WEBHOOK_URL secret in your Kestra namespace settings.
  3. Specify your application namespace in mesh_namespace.
  4. Execute a manual test run via the Kestra UI to verify metric ingestion.
  5. Enable the periodic_linkerd_audit trigger to establish automated continuous surveillance.

Common pitfalls and troubleshooting

  • Issuer vs Trust Anchor: Identity issuer certs auto-rotate via cert-manager; trust anchors require manual CA updates.
  • Clock Skew False Alarms: Out-of-sync node NTP clocks cause premature certificate expiration warnings.
  • Sidecar Proxy Injection Annotations: Missing linkerd.io/inject: enabled annotation leaves pods unmeshed.
  • Destination Service Headroom: High DNS lookups in large meshes increase memory pressure on destination controller.

How to extend

  • Automated Cert-Manager Sub-Flow: Trigger a cert-manager renewal task when identity certificate days drop below 15.
  • Pod Injection Remediation: Chain an automated rollout restart for deployments with unmeshed pod instances.
  • PagerDuty Escalation: Escalate to on-call security engineers if trust anchor expiry drops below 7 days.

Links

See How

New to Kestra?

Use blueprints to kickstart your first workflows.