Skip to content
Open Source

Upgrade and roll back Zeabur Identity

Back up and record your current deployment, review version differences, upgrade Zeabur Identity, and use data compatibility to decide whether to roll back to an older version or restore a backup.

Back up and record your current deployment, then review version differences, apply the new configuration, and verify sign-in and permissions. If you need to roll back, use data compatibility to decide whether to switch to the old image or restore the pre-upgrade backup.

Resource versions are still v1alpha1, and there's no conversion mechanism between versions. A newer version can change how it stores data, as the upgrade notes below list, so don't assume that switching versions in either direction will succeed. Record the full commit and image that's actually running. Don't record only a reusable tag such as zeabur-identity:dev.

kubectl rollout undo only restores the Pod template. It doesn't restore CRDs, users, signing keys, Secrets, RBAC, Services, Ingresses, or kube-apiserver files. After a newer version of Zeabur Identity writes data, there's no guarantee that an older version can read it.

Zeabur Identity runs a single replica. Updates replace that replica rather than perform a rolling update. An upgrade briefly interrupts service, and users who are signing in at that time must sign in again. Don't add replicas to hide the interruption.

Each version below lists what you must do before you upgrade to it. If you skip versions, read every section from the version you run now to the version you're moving to. The newest version is at the top.

v0.4.0 adds passwords for regular accounts and admin accounts, and replaces the admin-aal3 setting with admin-sign-in.

v0.4.0 no longer reads admin-aal3. Its default, two-factor, lets admins sign in with any passkey, or with a password and a code from an authenticator app. If the first command below prints true, keep the device-bound restriction with the second command. To keep admins on any passkey but no password, use admin-sign-in=passkey instead. The second command replaces the ConfigMap's data, so add --from-literal=teams=multiple if you set teams:

kubectl -n "$NS" get configmap zeabur-identity-settings -o jsonpath='{.data.admin-aal3}{"\n"}' --ignore-not-found
kubectl -n "$NS" create configmap zeabur-identity-settings --from-literal=admin-sign-in=device-bound-passkey \
--dry-run=client -o yaml | kubectl apply -f -

See Choose how admins sign in.

2. Create the password key before the new Deployment

Section titled “2. Create the password key before the new Deployment”

v0.4.0 keeps the key it mixes into password hashes in the Secret zeabur-identity-password-key. Installing Zeabur Identity creates it empty and Zeabur Identity fills it at startup, but Zeabur Identity can't create the Secret itself and doesn't start without it. The upgrade files below leave out Secrets, so create this one in the Review and apply the manifests step, before the new Deployment. The command does nothing when the Secret already exists:

kubectl -n "$NS" get secret zeabur-identity-password-key ||
jq '.items[] | select(.kind == "Secret" and .metadata.name == "zeabur-identity-password-key")' \
upgrade-record/manifests.next.json | kubectl create -f -

Back it up with the signing keys. See Back up and restore.

v0.3.0 has no passwords. Restore the pre-upgrade backup. Passwords and authenticator apps set after the upgrade are lost, and users who signed up with only a password need a new setup link.

v0.3.0 changes the form of UpstreamProvider and Credential. Stored credentials keep working as they are. Stored providers don't: the server doesn't start while a provider in the v0.2.0 form is stored, so write each one again in the new form.

v0.3.0 reads each provider's client secret from the key with the provider's name in the Secret zeabur-identity-upstream. clientSecretKey is gone. If a provider's clientSecretKey differs from its name, add the secret under the name as well:

kubectl -n "$NS" get upstreamproviders.identity.zeabur.com \
-o jsonpath='{range .items[*]}{.metadata.name}{"\t"}{.spec.clientSecretKey}{"\n"}{end}'

Do this before you apply the new CRDs. After that, the API server drops the fields v0.3.0 doesn't have, and the old values can't be read.

kubectl -n "$NS" get upstreamproviders.identity.zeabur.com -o json \
| jq '.items |= map({apiVersion, kind, metadata: (.metadata | {name, namespace, labels}), spec})' \
> upgrade-record/upstreamproviders.before.json
jq '.items |= map(.spec |= ({clientId} + if .type == "GitHub" then {github: {}}
else {openid: ({issuer, displayName} + if .scopes then {scopes} else {} end)} end))' \
upgrade-record/upstreamproviders.before.json > upgrade-record/upstreamproviders.next.json
/path/to/old/zeabur-identityctl crds > upgrade-record/crds.before.json

Read upstreamproviders.next.json, then apply it right after the new CRDs in the Review and apply the manifests step, before the new Deployment:

kubectl apply --server-side -f upgrade-record/crds.next.json
kubectl apply -f upgrade-record/upstreamproviders.next.json

Nothing to do. A Credential is a passkey when it has passkey and a linked account when it has external. The type and provider fields that v0.1 and v0.2.0 wrote are ignored. A Credential manifest of your own that sets type or provider fails kubectl apply until you remove them.

v0.2.0 can't read a Credential or a provider without type. Restore the pre-upgrade backup, or export the credentials, delete them, apply v0.2.0's CRDs and create them again with their v0.2.0 type. Do this with Zeabur Identity stopped. Each linked account gets the provider with the same issuer in upstreamproviders.before.json. If no provider there has an account's issuer, the account can't be written in the v0.2.0 form and is deleted. First export the credentials:

kubectl -n "$NS" get credentials.identity.zeabur.com -o json \
| jq --slurpfile p upgrade-record/upstreamproviders.before.json '
($p[0].items | map({key: (if .spec.type == "GitHub" then "https://github.com" else .spec.issuer end),
value: .metadata.name}) | from_entries) as $provider
| .items |= map(
{apiVersion, kind, metadata: (.metadata | {name, namespace, labels, ownerReferences}), spec}
| if .spec.passkey then .spec.type = "Passkey"
else .spec.type = "Upstream" | .spec.provider = $provider[.spec.external.issuer] end
| select(.spec.type == "Passkey" or .spec.provider != null))' \
> upgrade-record/credentials.v0.2.0.json

Read credentials.v0.2.0.json and check what it leaves out, then delete and recreate:

kubectl -n "$NS" delete credentials.identity.zeabur.com --all
kubectl -n "$NS" delete upstreamproviders.identity.zeabur.com --all
kubectl apply --server-side -f upgrade-record/crds.before.json
kubectl create -f upgrade-record/credentials.v0.2.0.json
kubectl create -f upgrade-record/upstreamproviders.before.json

kubectl create doesn't restore status, so passkeys lose the names users gave them after enrollment and their last sign-in time. Providers added or changed after the upgrade are gone too; add them again in the v0.2.0 form. Then switch back to the v0.2.0 image and manifests.

Upgrade from v0.1 straight to v0.3.0 or later, and skip the v0.2.0 section above. v0.2 sets up GitHub and Google sign-in with UpstreamProvider objects instead of server options and removes several server options. Passkeys and linked accounts keep working without a migration.

Leave these options and their ZEABUR_IDENTITY_* variables out of every --serve-arg when you generate the upgrade files, and delete any you added to the Deployment's args or env yourself. An option that is still set stops the server with an unknown-argument error:

  • --github-client-id, --github-client-secret-file, --google-client-id, --google-client-secret-file: replaced by UpstreamProvider objects (step 3).
  • --store: the server always keeps its state in Kubernetes objects.
  • --upstream-ca-file: the image's CA bundle already trusts GitHub and Google. If your cluster reaches them through a proxy that re-signs TLS with its own CA, mount that CA into a directory and set both SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt and SSL_CERT_DIR=<that directory> on the Deployment.
  • --key-rotation-period, --key-publish-ahead, --key-retain-after, --metadata-max-age, --key-secret: the server always uses the former defaults.
  • --worker-threads: the server starts one worker thread per CPU.

If you use Google sign-in and your cluster limits outgoing traffic, also allow HTTPS to accounts.google.com. Zeabur Identity now reads Google's endpoints from https://accounts.google.com/.well-known/openid-configuration before each sign-in.

3. Create the sign-in providers before the new Deployment

Section titled “3. Create the sign-in providers before the new Deployment”

If you use GitHub or Google sign-in, do this after you apply the new CRDs and before you apply the new manifests in the Review and apply the manifests step. Otherwise the Continue with GitHub and Continue with Google buttons disappear until you do.

Store each client secret in the Secret zeabur-identity-upstream, under the provider's name, github or google. Use the same client secrets as v0.1. Leave out a provider you don't use:

read -rs GITHUB_SECRET # paste the GitHub client secret, then Enter
read -rs GOOGLE_SECRET # paste the Google client secret, then Enter
kubectl -n "$NS" create secret generic zeabur-identity-upstream \
--from-file=github=<(printf %s "$GITHUB_SECRET") \
--from-file=google=<(printf %s "$GOOGLE_SECRET")
unset GITHUB_SECRET GOOGLE_SECRET

Then create one UpstreamProvider for each, with the client IDs you passed to --github-client-id and --google-client-id. Keep the names github and google: they are part of the callback URLs registered at GitHub and Google, so those stay the same.

GITHUB_CLIENT_ID=Ov23li... # not a secret
GOOGLE_CLIENT_ID=1234-abc.apps.googleusercontent.com
kubectl apply -f - <<EOF
apiVersion: identity.zeabur.com/v1alpha1
kind: UpstreamProvider
metadata: {name: github, namespace: $NS}
spec: {clientId: $GITHUB_CLIENT_ID, github: {}}
---
apiVersion: identity.zeabur.com/v1alpha1
kind: UpstreamProvider
metadata: {name: google, namespace: $NS}
spec:
clientId: $GOOGLE_CLIENT_ID
openid: {issuer: https://accounts.google.com, displayName: Google}
EOF

Save v0.1's CRDs with the old zeabur-identityctl next to your upgrade record. A rollback needs them, see below.

/path/to/old/zeabur-identityctl crds > upgrade-record/crds.before.json

Nothing to do. Each linked GitHub or Google account, a Credential with type: GitHub or type: Google, signs in through the provider with its issuer: github for https://github.com, google for https://accounts.google.com. v0.3.0 doesn't change these objects.

v0.1 can't read a Credential without type, and v0.3.0 writes credentials without it. Restore the pre-upgrade backup, as described under Roll back below, or export the credentials, delete them, apply the v0.1 CRDs and create them again with their v0.1 type. Do this with Zeabur Identity stopped. Accounts linked through a provider other than GitHub or Google have no v0.1 form, so they're deleted. First export the credentials:

kubectl -n "$NS" get credentials.identity.zeabur.com -o json | jq '.items |= map(
{apiVersion, kind, metadata: (.metadata | {name, namespace, labels, ownerReferences}),
spec: (.spec | del(.provider) | .type = (if .passkey then "Passkey"
else {"https://github.com": "GitHub", "https://accounts.google.com": "Google"}[.external.issuer] end))}
| select(.spec.type != null))' > upgrade-record/credentials.v0.1.json

Read credentials.v0.1.json and check what it leaves out, then delete and recreate:

kubectl -n "$NS" delete credentials.identity.zeabur.com --all
kubectl apply --server-side -f upgrade-record/crds.before.json
kubectl create -f upgrade-record/credentials.v0.1.json

kubectl create doesn't restore status, so passkeys lose the names users gave them after enrollment and their last sign-in time. Then switch back to the v0.1 image and manifests, with the options from step 1.

Verify emergency access and create a backup

Section titled “Verify emergency access and create a backup”

Confirm that access without Zeabur Identity works, then follow Backup and restore to create a full backup.

Record the backup time. If you restore this backup, you'll lose all data created after that time.

Record the source commit, the zeabur-identityctl version, and every option you used during installation, including the Issuer, Namespace, image, each --serve-arg, --config-secret, and all overlays. Keep a usable copy of the old image on every node.

Run the following commands to save the current deployment information. Keep these files confidential.

umask 077
NS=zeabur-identity
mkdir -m 0700 upgrade-record
kubectl -n "$NS" get deployment zeabur-identity -o yaml > upgrade-record/deployment.before.yaml
kubectl -n "$NS" get pods -l app.kubernetes.io/name=zeabur-identity \
-o jsonpath='{range .items[*]}{.metadata.name}{"\t"}{range .status.containerStatuses[*]}{.name}{"\t"}{.image}{"\t"}{.imageID}{"\n"}{end}{end}' \
> upgrade-record/image-identities.before.txt
kubectl -n "$NS" rollout history deployment/zeabur-identity > upgrade-record/rollout-history.before.txt

These files are deployment records, not backups.

Use a digest or a non-reusable tag that points to a known commit. Load the image onto every node that can run Zeabur Identity.

Use the new version of zeabur-identityctl with your original installation options to generate the new manifests into a file, then compare them with the current deployment. Don't pipe manifests generated with the new defaults directly into the cluster.

Review version differences and test the upgrade

Section titled “Review version differences and test the upgrade”

Do what Upgrade notes above lists for each version you pass. Then read the release notes between the two versions, including the CRD schema, storage format, options, and token claims.

Test the exact upgrade procedure on a restored copy first. Also test signing in with an existing passkey.

If you can't confirm that the old version can read the new data, restore the previous backup and accept the loss of data created after the backup.

If the data requires migration and no migration method exists, don't upgrade.

Replace the first four lines with your settings. The following manifests command matches the one in Install and sign in on k3s and enables invitations. Add every option you used during installation. If you didn't enable invitations in the original installation, remove --serve-arg=--invitations.

NS=zeabur-identity
NEXT_ZEABUR_IDENTITYCTL=/path/to/new/zeabur-identityctl
NEXT_IMAGE=registry.example.test/zeabur-identity@sha256:... # the new image, by digest
ZEABUR_IDENTITY_ISSUER=https://identity.example.test
"$NEXT_ZEABUR_IDENTITYCTL" crds > upgrade-record/crds.next.json
"$NEXT_ZEABUR_IDENTITYCTL" manifests --issuer "$ZEABUR_IDENTITY_ISSUER" --namespace "$NS" --image "$NEXT_IMAGE" \
--serve-arg=--invitations > upgrade-record/manifests.next.json
# Leave out the empty Secrets: they're only for new installs.
jq '.items |= map(select(.kind != "Secret"))' upgrade-record/manifests.next.json \
> upgrade-record/manifests.upgrade.json

Read upgrade-record/crds.next.json and upgrade-record/manifests.upgrade.json before applying them.

If a conflict occurs when you apply the manifests, find the cause first. Don't add --force-conflicts. Don't delete and recreate a CRD to resolve an error. That deletes every object of that type.

kubectl apply --server-side -f upgrade-record/crds.next.json
kubectl apply --server-side -f upgrade-record/manifests.upgrade.json
kubectl -n "$NS" rollout status deployment/zeabur-identity --timeout=5m
kubectl -n "$NS" logs deployment/zeabur-identity --tail=200

Keep the zeabur-identity Service, zeabur-identity-internal-ca, zeabur-identity-signing-keys, and zeabur-identity-password-key. Don't replace them. A new password key makes every password and authenticator app stop working. A new Service isn't guaranteed to retain the original IP, and every kube-apiserver's authentication file uses the old IP as a fixed value.

Don't replace the root CA, change the Issuer, or delete sessions during an upgrade. If the new version requires different kube-apiserver settings, treat that as a separate change and handle one machine at a time.

Check the image that's actually running, readiness, and logs, then complete these checks:

  • Sign in again with an existing passkey.
  • Attempt one operation you have permission to perform and one you don't.
  • Confirm that admin access works.

Sign-in can still fail after the Pod is ready, so complete every check above.

Stop writes if the data state is uncertain

Section titled “Stop writes if the data state is uncertain”

If you can't confirm what data the new version has written, stop Zeabur Identity first to prevent further writes:

kubectl -n zeabur-identity scale deployment/zeabur-identity --replicas=0

Choose a rollback method based on data compatibility

Section titled “Choose a rollback method based on data compatibility”

Switch to the old image only after you confirm that the old version can read the current data.

If only the image changed, run:

kubectl -n zeabur-identity set image deployment/zeabur-identity zeabur-identity="$PREVIOUS_IMAGE"

If the Pod template has other changes, inspect the revision history first:

kubectl rollout history deployment/zeabur-identity --revision=N

Then roll back to the specified revision:

kubectl rollout undo deployment/zeabur-identity --to-revision=N

Manually revert the other changes, then restore the replica count.

You can't confirm that the old version can read the current data

Section titled “You can't confirm that the old version can read the current data”

Follow the restore procedure in Backup and restore to restore the pre-upgrade backup, along with the old image, manifests, CRDs, and Secrets. Keep Zeabur Identity stopped throughout the restore.

You'll lose all changes made after the backup, including new passkeys and passwords, group changes, client updates, and key rotations.

Don't install an empty signing-key Secret, delete certificates, or issue new setup links to get the old version running.

Check the image, readiness, and logs, then sign in again. Confirm that regular access, admin access, and emergency access all work.

Record what you restored and what data you lost.