Skip to main content

Offline Self-Service

Early Access

This feature is currently in early access.

By default, an offline Traefik Hub gateway runs without any connection to the platform, which means the API Portal cannot offer self-service applications, self-service subscriptions, or API key management.

Offline Self-Service closes that gap. By deploying the Traefik Hub Manager alongside the gateway and backing it with a self-hosted PostgreSQL database, you keep the gateway fully offline while still letting portal users create applications, subscribe to APIs, and manage API keys themselves.

important

Offline Self-Service is available for Kubernetes deployments of Traefik Hub API Management. Any Kubernetes gateway with an offline license token can enable it by deploying Traefik Hub Manager and setting --hub.platformURL. See the installation steps for details.

How It Works

In Offline Self-Service mode, the gateway no longer talks to hub.traefik.io. Instead, it points at a Traefik Hub Manager service running in your cluster. Traefik Hub Manager exposes a restricted API surface that only handles self-service objects, and persists them in PostgreSQL.

Every other resource — APIs, API plans, catalog items, portals, managed applications and subscriptions — is still defined as a Kubernetes CRD, exactly like in standard offline mode.

Prerequisites

  • License Requirement: Offline Self-Service is a licensed feature. Access must be granted by the Traefik Labs sales team.
  • License Token: Your token must include the offline claim.
  • Kubernetes Cluster with kubectl and Helm v3.
  • A PostgreSQL instance reachable from the cluster.
  • An OIDC identity provider or LDAP directory for the API Portal (see APIPortalAuth).

Components

ComponentPurpose
Traefik Hub GatewayRoutes traffic, enforces authentication, and forwards self-service calls to the Traefik Hub Manager.
Traefik Hub ManagerManages self-service applications, subscriptions, and API keys, persisting them in PostgreSQL. Deployed via the hub-manager Helm chart.
PostgreSQLPersists applications, API keys, and self-service subscriptions. API keys are encrypted at rest using an AES key you provide.

Installation

The walkthrough below sets up a complete Offline Self-Service stack in a single traefik namespace.

Step 1: Create the Namespace and Secrets

Create the namespace, the license secret, and the secret that the Traefik Hub Manager uses for the PostgreSQL connection string and the API-key encryption key.

kubectl create namespace traefik

# License token
kubectl create secret generic traefik-hub-license \
--namespace traefik \
--from-literal=token='YOUR-OFFLINE-LICENSE-TOKEN'

# Example Postgres connection string and a 32-byte base64-encoded encryption key
kubectl create secret generic hub-manager-config \
--namespace traefik \
--from-literal=postgres-uri='postgresql://postgres:[email protected]:5432/postgres' \
--from-literal=postgres-encryption-key="$(openssl rand -base64 32)"
Encryption key

postgres-encryption-key is used to encrypt API keys at rest. Store it securely, for example in your secret manager. Encrypted data is tied to the key it was created with, so losing the key makes existing API keys unrecoverable.

Step 2: Deploy PostgreSQL

Traefik Hub Manager requires a PostgreSQL instance reachable from the cluster. The example below uses the in-cluster Bitnami PostgreSQL chart with a default installation.

helm install traefik-hub-postgresql \
oci://registry-1.docker.io/bitnamicharts/postgresql \
--namespace traefik \
--set auth.postgresPassword=CHANGEME

Wait for the traefik-hub-postgresql-0 pod to be Ready before continuing:

kubectl rollout status statefulset/traefik-hub-postgresql --namespace traefik --timeout=3m

Step 3: Install Traefik Hub Manager

Add the Traefik Helm repository and install the hub-manager chart. The chart runs a pre-install Job that creates the PostgreSQL schema, then deploys the Traefik Hub Manager service on port 80.

helm repo add --force-update traefik https://traefik.github.io/charts

helm install hub-manager traefik/hub-manager \
--namespace traefik \
--set token=traefik-hub-license \
--set postgres.uri=hub-manager-config \
--set postgres.encryptionKey=hub-manager-config

The three values reference Kubernetes Secret names — not their values. We've created them in a previous step. Traefik Hub Manager reads the following keys from those Secrets:

Helm valueSecret key it looks up
tokentoken
postgres.uripostgres-uri
postgres.encryptionKeypostgres-encryption-key

Verify Traefik Hub Manager is ready:

kubectl rollout status deployment/hub-manager --namespace traefik --timeout=2m

Step 4: Install Traefik Hub Gateway

Install the Traefik Hub Gateway with API Management and Offline Mode both enabled, and point it at the in-cluster Traefik Hub Manager service with --hub.platformURL.

Install with --set flags
helm install traefik traefik/traefik \
--namespace traefik \
--set hub.token=traefik-hub-license \
--set hub.offline=true \
--set hub.apimanagement.enabled=true \
--set "additionalArguments={--hub.platformURL=http://hub-manager.traefik.svc.cluster.local/agent}"
--hub.platformURL

This flag is only accepted when the license carries the offline claim. With an online license it returns a startup error; with an offline license but no --hub.platformURL the gateway runs in standard offline mode (no self-service).

Step 5: Configure the API Portal

Offline self-service requires the API Portal to authenticate consumers against an OIDC identity provider or LDAP directory. Create an APIPortalAuth and an APIPortal, then expose the portal with an IngressRoute. The example below uses OIDC; see APIPortalAuth for the full OIDC and LDAP reference.

OIDC client credentials
apiVersion: v1
kind: Secret
metadata:
name: portal-oidc
namespace: traefik
stringData:
clientId: my-portal-client
clientSecret: my-portal-secret

Step 6: Publish an API for Self-Service

Define an API, an APIAuth to protect it, an APIPlan, and an APICatalogItem. The APIPlan reference on the catalog item makes the API available for self-service subscription in the portal.

Whoami Deployment and Service
apiVersion: apps/v1
kind: Deployment
metadata:
name: whoami
namespace: traefik
spec:
replicas: 1
selector:
matchLabels:
app: whoami
template:
metadata:
labels:
app: whoami
spec:
containers:
- name: whoami
image: traefik/whoami:v1.12.0
---
apiVersion: v1
kind: Service
metadata:
name: whoami
namespace: traefik
spec:
selector:
app: whoami
ports:
- port: 80
targetPort: 80

Step 7: Subscribe and Test

  1. Open the API Portal (https://portal.example.com) and sign in with your OIDC provider or LDAP credentials.

  2. Create an Application.

  3. Subscribe the Application to the Whoami API.

  4. Generate an API key from the Application detail page and copy it.

  5. Call the protected API:

    # Without a key — denied
    curl -i https://whoami.example.com
    # HTTP/1.1 401 Unauthorized

    # With the generated key — allowed
    curl -i -H "Authorization: Bearer YOUR-API-KEY" https://whoami.example.com
    # HTTP/1.1 200 OK

The application, the subscription, and the API key are now stored in PostgreSQL via Traefik Hub Manager. The gateway never reaches out to hub.traefik.io.

Configuration Options

Traefik Hub Manager Helm values

KeyTypeDefaultDescription
tokenstring""Name of a Secret with key token set to a valid offline license token.
postgres.uristring""Name of a Secret with key postgres-uri set to a PostgreSQL connection string.
postgres.encryptionKeystring""Name of a Secret with key postgres-encryption-key set to a base64-encoded AES key (16, 24, or 32 bytes after decoding). Generate it with, for example, openssl rand -base64 32
image.registrystring"ghcr.io"Image registry.
image.repositorystring"traefik/hub-manager"Image repository.
image.tagstringnilDefaults to the chart's appVersion.
logs.levelstring"INFO"One of TRACE, DEBUG, INFO, WARN, ERROR, FATAL, PANIC.
deployment.replicasint1Number of Traefik Hub Manager replicas. Multiple replicas are supported.
autoscaling.enabledboolfalseCreate an HPA for Traefik Hub Manager.
tracing.addressstring""OTLP/HTTP endpoint for traces.
tracing.insecurebooltrueUse HTTP instead of HTTPS when sending traces.
tracing.probabilitystring"0.0"Probability (0.0–1.0) of sampling a trace.

Gateway flags

FlagRequiredDescription
--hub.offline=trueYesEnables offline mode. Must match the offline claim on the license.
--hub.apiManagementYesEnables API Management features.
--hub.platformURLYesURL of the in-cluster Traefik Hub Manager service, including the /agent path (e.g. http://hub-manager.traefik.svc.cluster.local/agent). Only accepted with an offline license.

Limitations

The following table shows what is available in each offline mode:

FeatureStandard OfflineOffline Self-Service
APIs, APIPlans, APICatalogItems via CRDs
Managed Applications and Subscriptions via CRDs
API Portal authentication (OIDC or LDAP)
Self-service applications from the portal
Self-service subscriptions from the portal
API key generation from the portal
Identity provider sync (user attribute sync)
Workspace-level auth (local Hub Platform UI)
Multi-cluster dashboard (local dashboard still available)
Operational Notes
  • Anonymous usage and version checks are turned off. Like standard offline mode, the gateway does not send telemetry, logs, or version checks to the platform.
  • License renewal is local. A lapsed license gets a 30-day grace period to renew and rotate a new token before it turns off. Offline gateways can't check this; update the token Secret only when rotating a new token.
  • Traefik Hub Manager is stateless. All state lives in PostgreSQL. You can scale it horizontally with deployment.replicas or autoscaling.enabled.

Troubleshooting

The gateway logs endpoint /agent/<path> is not available in offline mode

The gateway is attempting to use a feature that is not supported in Offline Self-Service mode. For example, this can happen if the portal configuration relies on online-only identity provider synchronization. Check the Limitations table for what is and isn't available in this mode.

The gateway exits at startup with the --platform-url is only available with an offline license

--hub.platformURL only takes effect with an offline license. Either remove the flag, or obtain a license with the offline claim. Online licenses must not set this flag.

The gateway exits with offline mode configuration mismatch

The offline claim on the license must match --hub.offline. Set hub.offline=true in Helm values when the license is offline, and remove it when it isn't.

Traefik Hub Manager pod stays in CrashLoopBackOff with invalid license: token is not an offline token

The token in the token Secret is valid but does not carry the offline claim — usually an online token pasted by mistake. Re-copy the offline token from the Hub dashboard and recreate the Secret.

Traefik Hub Manager pod stays in CrashLoopBackOff with invalid license: extracting claims: ...

The token in the token Secret fails signature verification — it is malformed or was not issued by Traefik Hub. Re-copy the offline token from the Hub dashboard and recreate the Secret.

Portal forms hang or return a 500 when submitting

The portal forwards self-service requests through the gateway to Traefik Hub Manager. If Traefik Hub Manager or PostgreSQL is unreachable, the request times out and the portal returns a generic 500. Check:

  • kubectl get pods -n traefik: PostgreSQL and hub-manager pods should be Running.
  • kubectl logs deployment/hub-manager -n traefik: look for PostgreSQL connection errors.
Migration job fails with FATAL: unrecognized configuration parameter (SQLSTATE 42704)

The postgres-uri value must be a plain libpq-style connection string. DSN parameters prefixed with pool_ are not supported. Use a connection string in the form postgresql://user:password@host:5432/dbname?sslmode=require.