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:nginx Ingress Controller
Use nginx’sauth_request annotation to protect your application:
ingress.yaml:
Traefik Ingress
For Traefik, use the ForwardAuth middleware: middleware.yaml:ConfigMap for Policy
Store custom Anubis policy in a ConfigMap: policy-configmap.yaml:Multiple Replicas
Anubis supports horizontal scaling:- All replicas must use the same signing key (via Secret)
- Use a shared store for rate limiting (Redis/Valkey)
Redis Deployment
For shared state across Anubis replicas:Namespace Isolation
Deploy Anubis in a dedicated namespace:Monitoring
Prometheus ServiceMonitor
Grafana Dashboard
Anubis exports Prometheus metrics on port 9090:anubis_challenges_total- Total challenges issuedanubis_challenges_passed- Challenges successfully solvedanubis_challenges_failed- Failed challenge attemptsanubis_requests_total- Total requests processed
Resource Limits
Recommended resource limits: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>
- Verify
REDIRECT_DOMAINSincludes your domain - Check
PUBLIC_URLmatches Anubis ingress hostname - Ensure
COOKIE_DOMAINis correct
- 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