Schedule icon
Request icon
Script icon
Process icon
Log icon
Switch icon
SlackIncomingWebhook icon
Fail icon

OpenFaaS Function Replica Saturation and Invocation Error Sentinel

Audit OpenFaaS serverless function replica availability via Gateway API, classify degradation severity, and dispatch Slack incident alerts to prevent outages.

Categories
Infrastructure

Automated serverless reliability sentinel that polls the OpenFaaS Gateway API on a recurring schedule to audit function replica availability, detect crashed or unscheduled function pods, classify service degradation severity, and dispatch Slack incident alerts before microservice invocations fail.

How it works

  1. A schedule trigger activates every five minutes to probe the OpenFaaS Gateway API.
  2. An HTTP request task queries the Gateway's /system/functions endpoint to retrieve real-time deployment status, requested replica targets, and currently available replica counts across all deployed functions.
  3. An embedded Python script processes the function array, comparing requested versus available replicas, identifying specific failing function names, and calculating overall cluster health metrics.
  4. An informational log task records the evaluated serverless metrics and current cluster classification.
  5. A Switch flow control task branches execution according to the evaluated status:
    • ALL_FUNCTIONS_HEALTHY: Confirms all serverless functions have full replica availability and logs nominal operational telemetry.
    • PARTIAL_REPLICA_DEGRADATION: Emits a non-blocking advisory notification when minor replica shortfalls fall within allowable thresholds.
    • CRITICAL_FUNCTION_OUTAGE: Dispatches a detailed Slack incident webhook with degraded function names, replica availability fractions, execution deep links, and halts execution via a failure gate.
  6. An immutable final audit log records the comprehensive health verdict and function availability metrics in Kestra execution history.

What you get

  • Proactive serverless health monitoring catching pod crashloops and image pull backoffs before invocations fail.
  • Automated detection of zero-replica function states and Kubernetes scheduling bottlenecks.
  • Rich Slack notifications alerting platform engineering teams with specific degraded function names and replica counts.
  • Automated execution failure gates that halt dependent data pipelines when upstream serverless processors are unavailable.
  • Complete, immutable audit records tracking serverless function replica stability across deployment windows.

Who it's for

  • Platform Engineers and Site Reliability Engineers (SREs) operating OpenFaaS on Kubernetes or Docker Swarm.
  • DevOps Teams maintaining event-driven serverless microservices and webhook ingestion pipelines.
  • Backend Architects requiring continuous SLA monitoring for asynchronous serverless workloads.

Why orchestrate this with Kestra

  • Declarative YAML orchestrates API health polling, JSON evaluation, and incident dispatching without dedicated sidecar daemons.
  • Native secret masking ensures administrative bearer tokens and Slack webhook URLs remain confidential during automated runs.
  • Built-in conditional branching enables granular escalation policies tailored to serverless failure thresholds.
  • Centralized execution timelines provide instant diagnostic visibility into historical function availability patterns.

Prerequisites

  • Running OpenFaaS Gateway (Kubernetes or Docker Swarm deployment) with the administrative API accessible.
  • Network reachability between Kestra and the OpenFaaS Gateway endpoint (default port 8080).

Secrets

  • OPENFAAS_API_TOKEN: Administrative authentication token or basic auth credentials for the OpenFaaS Gateway API.
  • SLACK_WEBHOOK_URL: Slack Incoming Webhook URL used to transmit critical function outage incident alerts.

Quick start

  1. Configure the OPENFAAS_API_TOKEN and SLACK_WEBHOOK_URL secrets in your Kestra namespace or environment variables.
  2. Import this blueprint into your Kestra instance under company.infrastructure.
  3. Run a manual test execution pointing to your OpenFaaS Gateway endpoint to verify connectivity and clean function parsing.
  4. Enable the openfaas_audit_schedule trigger to maintain continuous 5-minute serverless monitoring.

How to extend

  • Add an automated scale-up or pod restart task in the remediation branch via Kestra's Kubernetes plugin when functions stall.
  • Correlate function replica shortfalls with Prometheus invocation latency metrics (gateway_functions_seconds).
  • Route separate alerts to PagerDuty or Opsgenie when mission-critical payment or webhook functions reach zero available replicas.

Links

See How

New to Kestra?

Use blueprints to kickstart your first workflows.