Skip to content

Authservice

You’ll configure Authservice for production high availability by connecting it to an external Redis or Valkey session store and scaling to multiple replicas. This ensures SSO sessions persist across pod restarts and failovers.

  • UDS CLI installed
  • Access to a Kubernetes cluster (multi-node, multi-AZ recommended)
  • A Redis or Valkey instance accessible from the cluster
  • Applications using Authservice for SSO (see Identity & Authentication concepts for when Authservice is used vs. native SSO)
  1. Configure an external Redis session store

    Add the Redis URI to your uds-config.yaml:

    uds-config.yaml
    variables:
    core:
    AUTHSERVICE_REDIS_URI: redis://redis.redis.svc.cluster.local:6379
  2. Scale Authservice replicas

    With a session store configured, scale Authservice using a bundle override:

    uds-bundle.yaml
    packages:
    - name: core
    repository: registry.defenseunicorns.com/public/core
    ref: x.x.x-upstream
    overrides:
    authservice:
    authservice:
    values:
    # Number of Authservice replicas
    - path: replicaCount
    value: 2

    Alternatively, enable the HPA for dynamic scaling based on CPU utilization:

    uds-bundle.yaml
    packages:
    - name: core
    repository: registry.defenseunicorns.com/public/core
    ref: x.x.x-upstream
    overrides:
    authservice:
    authservice:
    values:
    # Enable HorizontalPodAutoscaler
    - path: autoscaling.enabled
    value: true
    SettingDefault
    Minimum replicas1
    Maximum replicas3
    CPU target utilization80%
  3. Create and deploy your bundle

    Terminal window
    uds create <path-to-bundle-dir>
    uds deploy uds-bundle-<name>-<arch>-<version>.tar.zst

Confirm Authservice HA is working:

Terminal window
# Check replica count
uds zarf tools kubectl get pods -n authservice -l app.kubernetes.io/name=authservice
# Check HPA (if enabled)
uds zarf tools kubectl get hpa -n authservice

Session persistence test: Log in to an Authservice-protected application, then delete one Authservice pod. Refresh the page — your session should survive:

Terminal window
# Delete one pod to simulate failover (replace with an actual pod name)
uds zarf tools kubectl delete pod -n authservice <pod-name>

Success criteria:

  • Multiple Authservice pods are Running and Ready
  • SSO login sessions survive pod deletion
  • No 503 errors during pod failover

Symptoms: Users are logged out or see login prompts after a pod restart, even with multiple replicas running.

Solution: Verify Redis connectivity from inside the cluster:

Terminal window
uds zarf tools kubectl logs -n authservice -l app.kubernetes.io/name=authservice --tail=50 | grep -i redis

Check that AUTHSERVICE_REDIS_URI is set correctly and that the Redis instance is reachable.

Symptoms: Users see 503 Service Unavailable when attempting to log in through Authservice.

Solution: Check Authservice pod logs for connection errors. Common causes:

  • Redis instance is down or unreachable
  • Incorrect Redis URI format
  • Network policy blocking Authservice → Redis traffic
Terminal window
uds zarf tools kubectl logs -n authservice -l app.kubernetes.io/name=authservice --tail=100

These guides and concepts may be useful to explore next: