Skip to content
Open Source

Zeabur Identity architecture

Learn how Zeabur Identity works in a Kubernetes cluster, its security properties, how its components interact, and how its crates divide responsibilities.

Zeabur Identity is an OpenID Connect Issuer that runs in a self-managed Kubernetes cluster. kube-apiserver uses Structured Authentication Configuration to verify Zeabur Identity's tokens itself. You can sign in with a passkey, an upstream account or a password, without holding a long-lived admin kubeconfig that can't be revoked. Other OpenID Connect clients, such as Argo CD, Grafana, and Headlamp, can use the same Issuer.

k3s and RKE2 use the same configuration. CI tests cover k3s.

  • Passkeys first. Passkeys are the primary credentials. They use WebAuthn and require user verification. Users can also sign in with a password of at least 15 characters, or link an account from GitHub, Google or another OpenID provider.
  • Only admin accounts receive admin privileges. Only a User with accountType: Admin receives the zeabur:admins group, which is bound to cluster-admin. The admin-sign-in setting decides how admin accounts sign in. By default, they use a passkey, or a password and an authenticator code. The setting can also require a passkey, or a device-bound passkey. Admin tokens expire after five minutes by default, and inactivity can end their sessions earlier. Regular accounts receive only the permissions bound to their groups. All sessions end 12 hours after sign-in.
  • Tokens are short-lived. They are bound to an audience, and signing keys rotate regularly.
  • Users manage their own sign-in methods. Adding or removing a passkey, or linking or unlinking an upstream account, requires the user to authenticate again with a passkey. Changing or removing a password requires the current password. Users can't remove their last passkey or unlink their last sign-in method.
  • Kubernetes stores the state. Custom resources store users, credentials, clients, sessions, and invitations. No database is required. For the order of access revocation and data deletion, see Sign out, recover, and remove users.

Specification conformance lists the specification requirements Zeabur Identity implements, along with the corresponding code and verification tests.

browser ──passkey──▶ zeabur-identity (in the cluster) ──tokens──▶ kubectl / OIDC clients
│ ▲ │
custom resources bearer token
▼ │ ▼
kube-apiserver ◀──discovery + keys (internal TLS)── verifies tokens itself

A kubectl request follows these steps.

kubelogin opens the browser to the Zeabur Identity sign-in page.

The user signs in with a passkey. kubelogin receives a short-lived access token and a refresh token, and Zeabur Identity records the session in a Grant object.

kubectl sends the token to kube-apiserver.

kube-apiserver verifies the token's signature with the keys Zeabur Identity publishes. It retrieves the keys over an internal TLS connection. Zeabur Identity doesn't participate in the request itself.

When the token expires, kubelogin uses the refresh token to obtain a new token without opening the browser.

The admin tool zeabur-identityctl runs on the administrator's computer with the administrator's own kubeconfig. It outputs installation manifests, generates a kube-apiserver AuthenticationConfiguration for the Kubernetes distribution, and issues one-time links for users to register passkeys.

The code is split into small crates, all at the same level in the crates/ directory:

  • Dependencies point downward and form no cycles. See Kladov, as well as Lakos and Martin in the references below.
  • Each crate encapsulates one design decision behind a narrow interface. See Parnas.
  • A set of traits defines the storage layer. Separate in-memory and Kubernetes implementations mean most tests don't need a cluster. This follows the ports and adapters architecture; see Cockburn.
  • The server and admin CLI use separate executables. Kanidm (kanidmd/kanidm), etcd (etcd/etcdctl), and cert-manager (cmctl) use the same division of responsibilities. Code that only administrators need to run stays out of the server image.

Each crate's README is also its crate-level documentation. Open it with cargo doc --open.

CrateWhat it holdsDepends on
zeabur-identity-apithe identity.zeabur.com custom resources and the names other programs share with Zeabur Identity—
zeabur-identity-coretime, cryptographic helpers, validated config values, endpoint paths, password, authenticator code and guessing-limit rules—
zeabur-identity-keyssigning keys, JWK publication, JWS signing and verification, rotationapi, core
zeabur-identity-storestorage ports (traits, records) and in-memory adaptersapi, core, keys
zeabur-identity-tlstrust roots, certificate issuance, a reloadable TLS listener—
zeabur-identity-uiserver-rendered pages, embedded assets, translations, security headerscore
zeabur-identity-oauththe OAuth 2.0 / OpenID Connect authorization serverapi, core, keys, store, ui
zeabur-identity-signinpasskey enrollment and sign-in, password and authenticator-code sign-in, upstream providers, page routesapi, core, keys, store, oauth, ui
zeabur-identity-k8sKubernetes adapters, GC, manifests, kube-apiserver configapi, core, keys, store, tls
zeabur-identitybinary: the in-cluster serverapi, core, keys, store, tls, oauth, signin, k8s
zeabur-identityctlbinary: the administrator's CLIapi, core, keys, k8s
zeabur-identity-test-support, zeabur-identity-e2etest helpers; end-to-end tests on a cluster—

The sign-in page's TypeScript and Tailwind source lives in ui/ and uses the Zeabur Design System as a package. Build output and the design system's style classes are committed to crates/zeabur-identity-ui and embedded in the executable. The style classes are stored as askama macros in templates/ds.html.

See CONTRIBUTING.md for development environment setup, checks, dependency policies, and cluster tests.