Authentik Blueprints Manual
Overview
Authentik blueprints provide a way to template, automate, and distribute authentik configuration as code. They allow you to define your authentication infrastructure declaratively using YAML files, enabling version control, reproducible deployments, and automated configuration management.
This manual focuses on the Kubernetes ConfigMap pattern for blueprint deployment, which provides automatic discovery and application of blueprints when authentik starts.
Table of Contents
- Basic Structure
- Deployment Patterns
- Helm Configuration for Blueprints
- Core Concepts
- Custom YAML Tags
- Working Examples
- Blueprint Development Methodology
- Common Use Cases
- Best Practices
- Troubleshooting
- Quick Reference
Basic Structure
Blueprint YAML Anatomy
Every authentik blueprint follows this basic structure:
# yaml-language-server: $schema=https://goauthentik.io/blueprints/schema.json
version: 1
metadata:
name: "Blueprint Name"
labels:
blueprints.goauthentik.io/instantiate: "true"
context: {}
entries:
- model: authentik_core.application
state: present
identifiers:
slug: "my-app"
attrs:
name: "My Application"
# ... other attributes
Required Components
| Component | Required | Description |
|---|---|---|
version | ✅ | Blueprint format version (currently 1) |
entries | ✅ | List of objects to create/manage |
metadata.name | ✅ | Human-readable blueprint name |
context | ❌ | Default context variables |
metadata.labels | ❌ | Special blueprint configuration labels |
Special Labels
| Label | Purpose |
|---|---|
blueprints.goauthentik.io/instantiate: "true" | Auto-apply blueprint on discovery |
blueprints.goauthentik.io/system: "true" | Mark as system blueprint |
blueprints.goauthentik.io/description: "text" | Blueprint description |
Deployment Patterns
Kubernetes ConfigMap Pattern (Recommended)
This is the pattern used in your working blueprints. It provides automatic discovery and application.
apiVersion: v1
kind: ConfigMap
metadata:
name: my-blueprint
namespace: authentik
labels:
app.kubernetes.io/name: authentik
app.kubernetes.io/component: blueprint
blueprints.goauthentik.io/instantiate: "true"
data:
blueprint.yaml: |
# yaml-language-server: $schema=https://goauthentik.io/blueprints/schema.json
version: 1
metadata:
name: "My Blueprint"
labels:
blueprints.goauthentik.io/instantiate: "true"
context: {}
entries:
# Your blueprint entries here
Key Benefits
- ✅ Automatic Discovery: Authentik automatically detects and applies blueprints
- ✅ Kubernetes Native: Deployed using standard Kubernetes resources
- ✅ Version Control: Can be managed in Git alongside other manifests
- ✅ Monitoring: Changes trigger automatic reapplication (every 60 minutes + file watchers)
Prerequisites
- Authentik namespace must exist
- Blueprint ConfigMaps must be applied BEFORE deploying Authentik with Helm
- Proper labels must be set for automatic discovery
- Blueprint names must be listed in Helm values under
blueprints.configMaps
Helm Configuration for Blueprints
Connecting ConfigMaps to Authentik
For blueprint ConfigMaps to be discovered and applied by Authentik, they must be explicitly listed in the Helm values configuration. This is a crucial step that connects your deployed ConfigMaps to the running Authentik instance.
Helm Values Configuration
Add the following to your Authentik Helm values file (e.g., values.yaml or values-authentik.yaml):
# Blueprint system configuration
blueprints:
# List of ConfigMaps containing blueprints
# Only keys ending with .yaml will be discovered and applied
configMaps:
- "whoami-forward-auth-blueprint" # Proxy authentication setup
- "openwebui-authentik-blueprint" # OAuth2/OIDC application setup
- "users-groups-test-blueprint" # Test blueprint for users and groups
# Add your blueprint ConfigMap names here
Complete Deployment Workflow
# 1. Deploy blueprint ConfigMaps FIRST (before Authentik)
kubectl apply -f manifests/073-authentik-whoami-blueprint.yaml
kubectl apply -f manifests/074-authentik-openwebui-blueprint-hardcoded.yaml
kubectl apply -f manifests/072-authentik-users-groups-blueprint.yaml
# 2. Verify ConfigMaps are created
kubectl get configmaps -n authentik -l app.kubernetes.io/component=blueprint
# 3. Deploy/upgrade Authentik with Helm (with blueprint references in values)
helm upgrade --install authentik authentik/authentik \
-n authentik \
-f values-authentik.yaml # Contains the blueprints.configMaps configuration
# 4. Monitor blueprint application
kubectl logs -n authentik deployment/authentik-server | grep -i blueprint
Blueprint Discovery Process
- ConfigMap Creation: Blueprint ConfigMaps are deployed to the
authentiknamespace - Helm Reference: ConfigMap names are listed in
blueprints.configMapsin Helm values - Authentik Startup: When Authentik starts, it reads the configured ConfigMap list
- Blueprint Loading: Authentik loads and applies blueprints from the referenced ConfigMaps
- Automatic Reapplication: Changes to ConfigMaps trigger reapplication (monitored every 60 minutes)
Key Configuration Rules
| Rule | Description | Example |
|---|---|---|
| Exact Name Match | ConfigMap names in Helm values must exactly match deployed ConfigMap names | configMaps: ["openwebui-authentik-blueprint"] |
| YAML Files Only | Only data keys ending with .yaml are processed | data: { "openwebui.yaml": "...", "readme.txt": "..." } ← Only openwebui.yaml processed |
| Namespace Consistency | ConfigMaps must be in the same namespace as Authentik | Both in authentik namespace |
| Deploy Before Helm | ConfigMaps must exist before Authentik deployment | kubectl apply -f blueprints/ then helm install |
Example Complete Helm Values
# values-authentik.yaml
authentik:
secret_key: "your-secret-key-here"
postgresql:
password: "your-pg-password"
# Blueprint system configuration
blueprints:
configMaps:
# Application blueprints
- "whoami-forward-auth-blueprint" # Forward auth proxy setup
- "openwebui-authentik-blueprint" # OAuth2/OIDC for OpenWebUI
- "grafana-saml-blueprint" # SAML setup for Grafana
# User management blueprints
- "users-groups-test-blueprint" # Test users and departments
- "ldap-import-blueprint" # LDAP user synchronization
# Flow customization blueprints
- "custom-login-flow-blueprint" # Custom authentication flow
- "mfa-enforcement-blueprint" # Multi-factor authentication
# Other Authentik configuration...
image:
tag: "2024.8.3"
postgresql:
enabled: true
auth:
postgresPassword: "your-pg-password"
database: "authentik"
redis:
enabled: true
Troubleshooting Helm Configuration
Blueprint Not Loading
Symptoms: ConfigMap exists but blueprint not applied
Check List:
-
Verify ConfigMap name in Helm values:
# Check deployed ConfigMap name
kubectl get configmaps -n authentik -l app.kubernetes.io/component=blueprint
# Compare with Helm values
helm get values authentik -n authentik -
Check ConfigMap data keys:
kubectl describe configmap openwebui-authentik-blueprint -n authentik
# Look for .yaml files in data section -
Verify Authentik can read ConfigMaps:
kubectl logs -n authentik deployment/authentik-server | grep -i "configmap\|blueprint"
Common Configuration Mistakes
| Issue | Wrong | Correct |
|---|---|---|
| Name Mismatch | configMaps: ["openwebui-blueprint"] | configMaps: ["openwebui-authentik-blueprint"] |
| Missing Quotes | configMaps: [openwebui-authentik-blueprint] | configMaps: ["openwebui-authentik-blueprint"] |
| Wrong Data Key | data: { "blueprint.yml": "..." } | data: { "blueprint.yaml": "..." } |
| Deploy Order | Helm first, then ConfigMaps | ConfigMaps first, then Helm |
Blueprint Updates and Redeployment
When updating blueprints:
# Update blueprint ConfigMaps
kubectl apply -f manifests/074-authentik-openwebui-blueprint-hardcoded.yaml
# Authentik automatically detects changes (within 60 minutes)
# Or force immediate reapplication:
kubectl rollout restart deployment/authentik-server -n authentik
Note: New blueprints require updating Helm values and redeploying Authentik, but existing blueprint changes are automatically detected.
Core Concepts
Models
Authentik blueprints work with Django models. Each entry specifies a model to create or modify:
| Common Models | Purpose |
|---|---|
authentik_core.application | Applications |
authentik_core.user | Users |
authentik_core.group | Groups |
authentik_providers_proxy.proxyprovider | Proxy providers |
authentik_providers_oauth2.oauth2provider | OAuth2/OIDC providers |
authentik_outposts.outpost | Outposts |
authentik_flows.flow | Authentication flows |
States
| State | Behavior |
|---|---|
present (default) | Keep object in sync with definition |
created | Create object if it doesn't exist, don't modify if it exists |
absent | Delete the object |
Identifiers vs Attributes
- Identifiers: Unique fields used to find existing objects
- Attributes: Properties to set on the object
entries:
- model: authentik_core.application
identifiers:
slug: "my-app" # Used to find the object
attrs:
name: "My App" # Properties to set
meta_launch_url: "https://app.example.com"
Object Relationships
Objects can reference each other using special tags:
entries:
# Create provider first
- model: authentik_providers_proxy.proxyprovider
identifiers:
name: "my-provider"
# ...
# Reference provider in application
- model: authentik_core.application
identifiers:
slug: "my-app"
attrs:
provider: !Find [authentik_providers_proxy.proxyprovider, [name, my-provider]]
Custom YAML Tags
!Find - Lookup Objects
Find objects by their attributes and return their primary key:
provider: !Find [authentik_providers_proxy.proxyprovider, [name, my-provider]]
flow: !Find [authentik_flows.flow, [slug, default-authentication-flow]]
!KeyOf - Reference by ID
Reference objects defined in the same blueprint by their id:
entries:
- model: authentik_flows.flow
identifiers:
slug: "my-flow"
id: flow # Set an ID
- model: authentik_flows.flowstagebinding
attrs:
target: !KeyOf flow # Reference by ID
!Context - Use Variables
Access context variables (useful for parameterized blueprints):
context:
app_name: "MyApp"
entries:
- model: authentik_core.application
attrs:
name: !Context app_name
!Format - String Formatting
Format strings with variables:
name: !Format ["%s-provider", !Context app_name]
!If - Conditional Logic
Conditionally include configuration:
attrs:
enabled: !If [!Context production, true, false]
!Env - Environment Variables
Use environment variables:
password: !Env SECRET_PASSWORD