Skip to main content
Anubis can be deployed on Kubernetes to protect applications using the nginx Ingress Controller’s external auth feature or Traefik’s ForwardAuth middleware.

Architecture

Deployment Manifest

Here’s a complete Anubis deployment for Kubernetes: deployment.yaml:

Service

service.yaml:

Signing Key Secret

Generate and store the signing key:
All Anubis replicas will use the same key for JWT signing.

nginx Ingress Controller

Use nginx’s auth_request annotation to protect your application: ingress.yaml:
Anubis Ingress (for challenge page):

Traefik Ingress

For Traefik, use the ForwardAuth middleware: middleware.yaml:
ingress.yaml:

ConfigMap for Policy

Store custom Anubis policy in a ConfigMap: policy-configmap.yaml:
Mount in deployment:

Multiple Replicas

Anubis supports horizontal scaling:
Critical requirements:
  1. All replicas must use the same signing key (via Secret)
  2. Use a shared store for rate limiting (Redis/Valkey)
With Redis store:

Redis Deployment

For shared state across Anubis replicas:

Namespace Isolation

Deploy Anubis in a dedicated namespace:
Update service references in Ingress:

Monitoring

Prometheus ServiceMonitor

Grafana Dashboard

Anubis exports Prometheus metrics on port 9090:
  • anubis_challenges_total - Total challenges issued
  • anubis_challenges_passed - Challenges successfully solved
  • anubis_challenges_failed - Failed challenge attempts
  • anubis_requests_total - Total requests processed

Resource Limits

Recommended resource limits:
Adjust based on traffic volume.

Autoscaling

Horizontal Pod Autoscaler based on CPU:

Network Policies

Restrict traffic to Anubis:

Troubleshooting

Check Logs

Test Auth Request

Verify Ingress Annotations

Common Issues

503 Service Unavailable:
  • Check Anubis pods are running: kubectl get pods -l app=anubis
  • Verify service endpoints: kubectl get endpoints anubis
  • Check health probe status: kubectl describe pod <anubis-pod>
Redirect loops:
  • Verify REDIRECT_DOMAINS includes your domain
  • Check PUBLIC_URL matches Anubis ingress hostname
  • Ensure COOKIE_DOMAIN is correct
Different challenge on each request:
  • All replicas need the same signing key
  • Use Redis for shared state

Production Checklist

  • Use dedicated namespace
  • Set resource limits
  • Configure autoscaling
  • Use Redis/Valkey for multi-replica deployments
  • Store signing key in Secret
  • Enable TLS with cert-manager
  • Configure network policies
  • Set up Prometheus monitoring
  • Configure log aggregation
  • Test failover scenarios
  • Document REDIRECT_DOMAINS and PUBLIC_URL

Complete Example

See the test configuration at /home/daytona/workspace/source/test/nginx-external-auth/ for a working Kubernetes deployment example with:
  • Deployment with sidecar pattern
  • Service configuration
  • Ingress with external auth
  • ConfigMap for nginx config

Resources