Schedule icon
Request icon
Switch icon
SlackIncomingWebhook icon
Log icon

Ory Kratos Identity Service Readiness & Health Sentinel

Audit Ory Kratos identity engine readiness, assert database query health, and dispatch operational Slack alerts on failure.

Categories
Infrastructure

Continuously monitors Ory Kratos headless identity and authentication deployments, asserting readiness probe health and administrative identity querying capabilities to detect database connection pool exhaustion, schema migration blocks, or identity trait deserialization failures before user authentication outages occur.

How it works

  1. periodic_kratos_audit (io.kestra.plugin.core.trigger.Schedule) executes every 15 minutes, passing target host, admin port, and notification channel inputs. Shipped disabled by default to facilitate initial verification.
  2. probe_kratos_readiness (io.kestra.plugin.core.http.Request) invokes the administrative endpoint GET /admin/health/ready to verify that the database connection pool is healthy, pending SQL migrations are applied, and cryptographic secrets are decryptable.
  3. probe_identity_query (io.kestra.plugin.core.http.Request) invokes GET /admin/identities?per_page=1 to confirm that Kratos can read from the persistent data store and successfully parse user traits against registered JSON schemas.
  4. classify_kratos_status (io.kestra.plugin.core.flow.Switch) evaluates the probe responses:
    • ENGINE_UNREADY: Triggers if /admin/health/ready returns a status other than ok (e.g. 503 during database disconnection), dispatching an urgent alert to #identity-ops via io.kestra.plugin.slack.notifications.SlackIncomingWebhook.
    • IDENTITY_QUERY_FAILED: Triggers if the identity query returns an HTTP error code (>= 400), alerting on trait schema validation bugs or database read timeouts.
    • HEALTHY: Confirms operational readiness and nominal query performance, logging state via io.kestra.plugin.core.log.Log.
  5. log_audit_complete always records execution completion and target endpoint metadata for regulatory compliance history.
  6. The global errors block intercepts network timeouts and connection drops to immediately notify on-call engineers when the Kratos container is unreachable.

What you get

  • Early detection of database connection exhaustion or schema migration stalls affecting user authentication.
  • Continuous validation that administrative APIs can retrieve and deserialize identity records without schema conflicts.
  • Zero external dependency monitoring: probes standard Kratos admin REST endpoints natively supported in all open-source deployments.
  • Clean audit records providing a verifiable operational trail of authentication service availability.

Who it's for

  • Identity and Access Management (IAM) Engineers operating open-source authentication backends.
  • Platform and SRE teams running Ory Kratos as an authentication microservice in Kubernetes or Docker.
  • Security teams requiring independent uptime and health verification of identity data stores.

Why orchestrate this with Kestra

Ory Kratos provides dedicated readiness and identity APIs, but relies on external orchestrators to execute recurring health assertions, evaluate multiple probe signals, and alert on-call teams across collaboration platforms. Kestra provides declarative scheduling, robust error handling, secret masking, and structured Slack integration without custom sidecar code.

Prerequisites

  • A running Ory Kratos instance (version 1.0+), with its administrative port exposed and reachable over HTTP. Ory publishes an official open-source Docker image (oryd/kratos:latest) requiring no commercial license or account.
  • A Slack incoming webhook URL configured for operational alerts.

Secrets

  • SLACK_WEBHOOK_URL: Slack incoming webhook URL used by alert_engine_unready, alert_query_failed, and the global errors block.

Quick start

  1. Start a local Ory Kratos container with in-memory SQLite storage:
    docker run -d --name kratos-test -p 4433:4433 -p 4434:4434 -e DSN=memory -e DEV=true oryd/kratos:latest serve --dev
    
  2. Configure the SLACK_WEBHOOK_URL secret in your Kestra namespace.
  3. Import this blueprint into Kestra and trigger an execution with default inputs.
  4. Confirm that log_healthy_state logs nominal readiness (status: ok).
  5. Temporarily point kratos_admin_port at an unused port and re-run to confirm that alert_kratos_unreachable fires.
  6. Enable periodic_kratos_audit once verified.

How to extend

  • Add an identity creation canary task (POST /admin/identities) that creates and immediately deletes a synthetic test user to validate end-to-end write path availability.
  • Wire a downstream PagerDuty escalation via io.kestra.plugin.pagerduty.notifications.PagerDutyAlert when ENGINE_UNREADY fires in production environments.
  • Query Kratos Prometheus metrics (GET /admin/prometheus/metrics) to alert on authentication session creation velocity and error rates.

Links

See How

New to Kestra?

Use blueprints to kickstart your first workflows.