Install on k3s on Ubuntu and sign in to kubectl
Install Zeabur Identity on an Ubuntu server, configure HTTPS and an admin account, and sign in to your k3s cluster from your computer.
Install Zeabur Identity on an Ubuntu server, configure HTTPS, and create the first admin account. You can then sign in to the k3s cluster from your computer and run kubectl. The server uses k3s's built-in Traefik to handle Ingress.
Keep the cluster's admin kubeconfig on the server to install components or recover access if Zeabur Identity stops working. Keep a separate encrypted copy offline. Your computer gets only the cluster's CA certificate and a kubeconfig that uses Zeabur Identity for sign-in.
Your computer server (k3s) browser ──https://identity.example.test──▶ Traefik :443 ──▶ zeabur-identity (zeabur-identity) kubectl ──https://identity.example.test:6443──▶ kube-apiserver │ verifies tokens itself; discovery and keys └─▶ https://<zeabur-identity ClusterIP> (internal TLS)Before you begin
Section titled “Before you begin”Prepare two machines:
- Your computer: Runs your browser and
kubectl. You can use macOS, Linux, or Windows. The commands use a POSIX shell; use WSL on Windows. - Server: Runs k3s and Zeabur Identity. You can use a VPS, a home lab host, a spare computer, or a local VM, as long as your computer can reach the Ubuntu machine over the network.
On your computer, prepare:
kubectl.- kubelogin: A
kubectlplugin that opens a browser for sign-in. Install it with Homebrew usingbrew install int128/kubelogin/kubelogin, with Nix usingnixpkgs#kubelogin-oidc, or install krew first and runkubectl krew install oidc-login. - mkcert: Run
mkcert -installonce in the environment where your browser runs to trust the local CA. The command prompts for a password if needed. Firefox also requires NSS'scertutil; see the mkcert README. With WSL, the browser runs on Windows, so install the Windows version, for example, withwinget install FiloSottile.mkcert. Callmkcert.exefrom WSL both here and in step 4. - SSH access to the server using
ssh.
The server needs:
- Ubuntu 24.04 or later on
amd64orarm64. - 4 CPUs, 8 GiB of memory, and 30 GiB of free disk space.
curland cosign 3.x.- Access from your computer to TCP ports 443 (sign-in) and 6443 (Kubernetes API).
Use a spare machine or VM. The following steps install k3s and change its configuration.
The examples use these names. Replace them with your own values:
| Name | Example value |
|---|---|
| Server hostname | identity.example.test |
| Issuer (Zeabur Identity's public URL) | https://identity.example.test |
| Server SSH login | ubuntu@identity.example.test; the user needs sudo privileges |
The hostname must resolve to the server from your computer. If you use your own domain, add a DNS record. .test names don't resolve on the internet, so add an entry to your hosts file instead: /etc/hosts on Linux and macOS, or C:\Windows\System32\drivers\etc\hosts on Windows.
WSL copies the Windows hosts file when it starts. After you edit the file, run wsl --shutdown on Windows, then open a new WSL terminal.
Keep two terminals open: one on your computer and one logged in to the server. Each step specifies where to run the commands. In your computer's terminal, set the SSH login for later commands:
SERVER=ubuntu@identity.example.testDownload and verify Zeabur Identity
Section titled “Download and verify Zeabur Identity”Sign in to the server from your computer:
ssh "$SERVER"These commands use the latest version on GitHub Releases and print it, for example v0.2.0. To pin another version, set version yourself. Set arch to amd64 for x86_64 or arm64 for aarch64:
version=$(curl -fsSLo /dev/null -w '%{url_effective}' https://github.com/zeabur-oss/identity/releases/latest)version=${version##*/}echo "$version"arch=arm64mkdir -p ~/zeabur-identity-downloadDownload the CLI, signed checksums, and image digests. These commands verify the files before installing zeabur-identityctl:
( set -eu cd ~/zeabur-identity-download url="https://github.com/zeabur-oss/identity/releases/download/$version" archive="zeabur-identityctl-$version-linux-$arch.tar.gz" for file in "$archive" SHA256SUMS SHA256SUMS.sigstore.json digests.txt; do curl --fail --location "$url/$file" --output "$file" done identity='^https://github\.com/zeabur-oss/(identity|\.github)/\.github/workflows/release\.yml@' cosign verify-blob --bundle SHA256SUMS.sigstore.json \ --certificate-identity-regexp "$identity" \ --certificate-github-workflow-repository zeabur-oss/identity \ --certificate-github-workflow-ref "refs/tags/$version" \ --certificate-oidc-issuer https://token.actions.githubusercontent.com SHA256SUMS sha256sum --check --strict --ignore-missing SHA256SUMS tar -xzf "$archive" sudo install -m 0755 zeabur-identityctl /usr/local/bin/zeabur-identityctl zeabur-identityctl --version)The last line prints the version without the v, for example zeabur-identityctl 0.2.0. A failed check stops the commands before that line.
Next, verify the image and its SBOM, the list of dependencies in the image. ZEABUR_IDENTITY_IMAGE stores the exact image digest for this version for use during installation:
ZEABUR_IDENTITY_IMAGE=$(awk '$1 == "index" {print $2}' ~/zeabur-identity-download/digests.txt)export ZEABUR_IDENTITY_IMAGEidentity='^https://github\.com/zeabur-oss/(identity|\.github)/\.github/workflows/release\.yml@'cosign verify --certificate-identity-regexp "$identity" \ --certificate-github-workflow-repository zeabur-oss/identity \ --certificate-github-workflow-ref "refs/tags/$version" \ --certificate-oidc-issuer https://token.actions.githubusercontent.com "$ZEABUR_IDENTITY_IMAGE"cosign verify-attestation --type cyclonedx --certificate-identity-regexp "$identity" \ --certificate-github-workflow-repository zeabur-oss/identity \ --certificate-github-workflow-ref "refs/tags/$version" \ --certificate-oidc-issuer https://token.actions.githubusercontent.com "$ZEABUR_IDENTITY_IMAGE"Continue only after both verification commands succeed. See Release artifacts and verification for supported platforms and other release artifacts.
Install k3s
Section titled “Install k3s”Run these commands on the server to add the hostname to the API server certificate and create an empty authentication configuration file. Step 5 adds the Zeabur Identity configuration.
sudo mkdir -p /etc/rancher/k3s/zeabur-identity /etc/rancher/k3s/config.yaml.dsudo tee /etc/rancher/k3s/zeabur-identity/authn.yaml >/dev/null <<'EOF'apiVersion: apiserver.config.k8s.io/v1kind: AuthenticationConfigurationanonymous: enabled: falsejwt: []EOFsudo tee /etc/rancher/k3s/config.yaml >/dev/null <<'EOF'# The name your computer uses for the API server.tls-san: [identity.example.test]EOFsudo tee /etc/rancher/k3s/config.yaml.d/50-zeabur-identity.yaml >/dev/null <<'EOF'kube-apiserver-arg: - "authentication-config=/etc/rancher/k3s/zeabur-identity/authn.yaml"EOFcurl -sfL https://get.k3s.io | sudo INSTALL_K3S_VERSION=v1.37.2+k3s1 sh -
install -d -m 700 ~/.kubesudo install -o "$USER" -m 600 /etc/rancher/k3s/k3s.yaml ~/.kube/configexport KUBECONFIG="$HOME/.kube/config"~/.kube/config contains credentials with cluster-admin privileges. Use it only to install components or recover access when Zeabur Identity is unavailable, not for daily work. Keep it on the server, and follow Keep an access path that bypasses Zeabur Identity to store a separate encrypted copy offline.
Confirm that the node and k3s's built-in Ingress are ready:
kubectl wait --for=condition=Ready node --all --timeout=180skubectl -n kube-system wait --for=create deployment/traefik --timeout=180skubectl -n kube-system rollout status deployment/traefik --timeout=180sInstall cert-manager. In step 5, it issues and renews the certificate that kube-apiserver uses to connect to Zeabur Identity:
kubectl apply --server-side -f https://github.com/cert-manager/cert-manager/releases/download/v1.21.3/cert-manager.yamlkubectl -n cert-manager wait deployment --all --for=condition=Available --timeout=300sInstall Zeabur Identity
Section titled “Install Zeabur Identity”Run these commands in the same server shell:
export ZEABUR_IDENTITY_ISSUER=https://identity.example.testzeabur-identityctl crds | kubectl apply --server-side -f -kubectl wait --for=condition=Established --timeout=90s \ crd/users.identity.zeabur.com crd/credentials.identity.zeabur.com \ crd/oauthclients.identity.zeabur.com crd/grants.identity.zeabur.com \ crd/invitations.identity.zeabur.comzeabur-identityctl manifests --image "$ZEABUR_IDENTITY_IMAGE" \ --serve-arg=--invitations | kubectl apply --server-side -f -kubectl -n zeabur-identity rollout status deploy/zeabur-identity --timeout=180sThe last command prints deployment "zeabur-identity" successfully rolled out.
The generated manifests include RBAC, a Service, and a Deployment. All resources that Zeabur Identity manages reside in the zeabur-identity Namespace. --invitations enables links to invite users.
Continue using this server shell. If you open a new shell, restore these settings first:
export KUBECONFIG="$HOME/.kube/config"export ZEABUR_IDENTITY_ISSUER=https://identity.example.testZEABUR_IDENTITY_IMAGE=$(kubectl -n zeabur-identity get deployment zeabur-identity -o jsonpath='{.spec.template.spec.containers[0].image}')export ZEABUR_IDENTITY_IMAGEExpose the sign-in page over HTTPS
Section titled “Expose the sign-in page over HTTPS”Browsers require a trusted HTTPS connection to create passkeys. This guide uses mkcert for your test computer. For a public service, use a certificate from a public CA instead, for example, with cert-manager.
On your computer, issue a certificate for the Issuer's hostname, then copy it to the server. Copy only the certificate and its private key. Keep the CA private key on your computer. With WSL, replace mkcert with mkcert.exe.
mkcert -cert-file zeabur-identity.crt -key-file zeabur-identity.key identity.example.testssh "$SERVER" 'install -d -m 700 ~/zeabur-identity-tls'scp zeabur-identity.crt zeabur-identity.key "$SERVER":zeabur-identity-tls/rm zeabur-identity.keyOn the server, store the certificate in a Secret and create an Ingress. Traefik in k3s receives HTTPS on port 443 and forwards requests to Zeabur Identity:
kubectl -n zeabur-identity create secret tls zeabur-identity-tls \ --cert=$HOME/zeabur-identity-tls/zeabur-identity.crt --key=$HOME/zeabur-identity-tls/zeabur-identity.keykubectl apply -f - <<'EOF'apiVersion: networking.k8s.io/v1kind: Ingressmetadata: name: zeabur-identity namespace: zeabur-identity annotations: traefik.ingress.kubernetes.io/router.entrypoints: websecure traefik.ingress.kubernetes.io/router.tls: "true"spec: ingressClassName: traefik tls: - hosts: [identity.example.test] secretName: zeabur-identity-tls rules: - host: identity.example.test http: paths: - path: / pathType: Prefix backend: service: name: zeabur-identity port: {number: 80}EOFWait a few seconds for Traefik to load the route and certificate, then check from your computer. In the JSON response, issuer should be https://identity.example.test:
curl --cacert "$(mkcert -CAROOT)/rootCA.pem" \ https://identity.example.test/.well-known/openid-configurationWhen you use the Windows version of mkcert from WSL, mkcert -CAROOT outputs a Windows path. Convert it first:
curl --cacert "$(wslpath "$(mkcert.exe -CAROOT | tr -d '\r')")/rootCA.pem" \ https://identity.example.test/.well-known/openid-configurationRate-limit sign-in requests before making the service public
Section titled “Rate-limit sign-in requests before making the service public”Public servers should rate-limit sign-in endpoints by client IP address. Skip this section if only you can reach the server.
On the server, set Traefik's externalTrafficPolicy to Local so the k3s load balancer preserves visitor IP addresses. Each address then gets its own rate-limit counter:
kubectl apply -f - <<'EOF'apiVersion: helm.cattle.io/v1kind: HelmChartConfigmetadata: {name: traefik, namespace: kube-system}spec: valuesContent: |- service: spec: externalTrafficPolicy: LocalEOFThis uses the k3s method for configuring Traefik. In a multi-node cluster with Local, only nodes that run a Traefik Pod receive traffic.
Next, add rate limiting to the sign-in routes:
kubectl apply -f - <<'EOF'apiVersion: traefik.io/v1alpha1kind: Middlewaremetadata: {name: zeabur-identity-rate-limit, namespace: zeabur-identity}spec: rateLimit: average: 10 period: 1s burst: 20---apiVersion: networking.k8s.io/v1kind: Ingressmetadata: name: zeabur-identity-rate-limited namespace: zeabur-identity annotations: traefik.ingress.kubernetes.io/router.entrypoints: websecure traefik.ingress.kubernetes.io/router.tls: "true" traefik.ingress.kubernetes.io/router.middlewares: zeabur-identity-zeabur-identity-rate-limit@kubernetescrdspec: ingressClassName: traefik tls: - hosts: [identity.example.test] secretName: zeabur-identity-tls rules: - host: identity.example.test http: paths: - {path: /authorize, pathType: Exact, backend: {service: {name: zeabur-identity, port: {number: 80}}}} - {path: /token, pathType: Exact, backend: {service: {name: zeabur-identity, port: {number: 80}}}} - {path: /par, pathType: Exact, backend: {service: {name: zeabur-identity, port: {number: 80}}}} - {path: /revoke, pathType: Exact, backend: {service: {name: zeabur-identity, port: {number: 80}}}} - {path: /login, pathType: Prefix, backend: {service: {name: zeabur-identity, port: {number: 80}}}} - {path: /setup, pathType: Prefix, backend: {service: {name: zeabur-identity, port: {number: 80}}}} - {path: /upstream, pathType: Prefix, backend: {service: {name: zeabur-identity, port: {number: 80}}}}EOFFrom your computer, send 60 concurrent requests to check the rate limit. Expect about 20 responses with status 200 and the rest with 429 Too Many Requests:
ca="$(mkcert -CAROOT)/rootCA.pem"for i in $(seq 1 60); do curl -s -o /dev/null -w '%{http_code}\n' --cacert "$ca" https://identity.example.test/login &done | sort | uniq -cThese values are a starting point. Adjust them for your usage:
- Users behind the same NAT share an IP address and a rate limit. Raise the limit if everyone in an office signs in at the same time each morning.
- If another proxy sits in front of Traefik, trust forwarded headers only from that proxy. Otherwise, everyone shares one rate limit, or someone can forge headers to bypass it.
See Traefik's RateLimit options for configuration details.
Configure kube-apiserver to trust Zeabur Identity
Section titled “Configure kube-apiserver to trust Zeabur Identity”First, confirm that you can access the cluster without Zeabur Identity. On the server, check the admin kubeconfig from step 2:
sudo k3s kubectl --kubeconfig=/etc/rancher/k3s/k3s.yaml auth whoamisudo k3s kubectl --kubeconfig=/etc/rancher/k3s/k3s.yaml get --raw=/readyzIf either command fails, stop and fix the problem before continuing. If you haven't stored an encrypted copy offline yet, back it up now.
kube-apiserver verifies Zeabur Identity tokens itself and fetches signing keys over internal HTTPS. zeabur-identityctl kube-config asks cert-manager to issue the certificate for this connection, then outputs the configuration that kube-apiserver needs. It also outputs k3s configuration instructions, including one restart. Step 2 already completed that part, so skip those instructions.
kube-apiserver checks the configuration file about once a minute. Compare the successful reload count before and after the change to confirm that the new configuration took effect. Define these two helper functions in the server shell:
# Successful reloads of the authentication configuration so far.reloads() { kubectl get --raw /metrics | awk '/^apiserver_authentication_config_controller_automatic_reloads_total/ && /status="success"/ { n += $NF } END { print n + 0 }'}# Waits up to three minutes for the count to pass $1; prints the k3s log if it never does.wait_for_reload() { for _ in $(seq 1 36); do [ "$(reloads)" -gt "$1" ] && return 0 sleep 5 done echo "Authentication configuration did not reload; inspect k3s logs." >&2 sudo journalctl -u k3s --since "5 minutes ago" --no-pager return 1}Write the new configuration to a temporary file, then move it into place in one operation so kube-apiserver doesn't read a partially written file. Then wait for the reload:
before=$(reloads)zeabur-identityctl kube-config --distro k3s > ~/authn.yaml && sudo install -m 600 ~/authn.yaml /etc/rancher/k3s/zeabur-identity/.authn.yaml.tmp && sudo mv /etc/rancher/k3s/zeabur-identity/.authn.yaml.tmp /etc/rancher/k3s/zeabur-identity/authn.yaml && wait_for_reload "$before"Register kubectl and set up the first admin
Section titled “Register kubectl and set up the first admin”Every application that uses Zeabur Identity for sign-in must register as a client. On the server, register kubectl so kubelogin can receive the sign-in result on 127.0.0.1:
zeabur-identityctl client create kubectl --type public \ --redirect-uri http://127.0.0.1:8000/ --audience kubernetes | kubectl apply -f -Get a one-time setup link for the first admin:
zeabur-identityctl setup-link --username adminThis creates the admin user as an admin account. By default, admin accounts sign in with a passkey, or with a password and a code from an authenticator app, and receive full Kubernetes privileges through cluster-admin. See Admin accounts and sessions.
Open the output link in your computer's browser and select Create passkey. Without a passkey, select Use a password instead, set a password of at least 15 characters, scan the QR code with an authenticator app, enter its code, and keep the 10 recovery codes. The link works once and expires after 60 minutes. Run the command again if you need a new link.
Check on the server that the admin has a sign-in method. The output lists one Credential with admin in the USER column:
kubectl -n zeabur-identity get credentialsConfigure kubectl on your computer
Section titled “Configure kubectl on your computer”From your computer, copy the cluster's CA certificate from the server.
CA=$(ssh "$SERVER" "grep certificate-authority-data ~/.kube/config | awk '{print \$2}'")Next, write the kubeconfig. After you sign in, kubelogin uses a refresh token to renew tokens automatically until the session ends:
mkdir -p ~/.kubecat > ~/.kube/zeabur-identity-k3s.yaml <<EOFapiVersion: v1kind: Configclusters:- name: zeabur-identity-k3s cluster: server: https://identity.example.test:6443 certificate-authority-data: $CAusers:- name: passkey user: exec: apiVersion: client.authentication.k8s.io/v1 interactiveMode: IfAvailable command: kubectl args: [oidc-login, get-token, --oidc-issuer-url=https://identity.example.test, --oidc-client-id=kubectl, --oidc-use-access-token, --listen-address=127.0.0.1:8000, --oidc-redirect-url=http://127.0.0.1:8000/]contexts:- {name: zeabur-identity-k3s, context: {cluster: zeabur-identity-k3s, user: passkey}}current-context: zeabur-identity-k3sEOFKrew and Nix install kubelogin as a kubectl plugin, so you can use this configuration as written. If you installed it with Homebrew, change it to command: kubelogin and remove oidc-login from args.
With WSL, kubelogin runs inside Linux and can't access the CA trusted by the Windows version of mkcert. Use the path from the check in step 4 to add the CA to args:
wslpath "$(mkcert.exe -CAROOT | tr -d '\r')" # e.g. /mnt/c/Users/you/AppData/Local/mkcert --certificate-authority=/mnt/c/Users/you/AppData/Local/mkcert/rootCA.pem,kubelogin also can't open the Windows browser from WSL. It prints Please visit the following URL in your browser manually: http://127.0.0.1:8000/ instead. Open that address in your browser to continue signing in.
Keep --oidc-use-access-token. kube-apiserver accepts only Zeabur Identity access tokens, not ID tokens.
By default, kubelogin stores refresh tokens in ~/.kube/cache/oidc-login. Add --token-cache-storage=keyring to store them in the system keyring instead. With --token-cache-storage=none, kubelogin doesn't store tokens and opens the sign-in page every time you run kubectl.
Sign in and test permissions
Section titled “Sign in and test permissions”Run these commands on your computer to sign in, check your identity, list Pods, and test creating and deleting a ConfigMap:
export KUBECONFIG=~/.kube/zeabur-identity-k3s.yamlkubectl auth whoami # opens the browser; user zeabur:admin, group zeabur:adminskubectl get pods -A # allowed: zeabur:admins is bound to cluster-adminkubectl -n default create configmap zeabur-identity-permission-check --from-literal=check=okkubectl -n default delete configmap zeabur-identity-permission-checkCheck the results
Section titled “Check the results”- Admin tokens renew automatically: Tokens expire after 5 minutes and renew without interaction. You must sign in again 12 hours after the initial sign-in or after 1 hour without using
kubectl; the idle timeout is 15 minutes for clusters shared by multiple teams. Regular account tokens expire after 10 minutes. See Admin accounts and sessions. - Use admin accounts only for administrative work: For daily work, invite yourself to create a regular account, then bind permissions to groups as needed. See Manage users.
- Users, sign-in methods, and sessions are Kubernetes objects: They reside in the
zeabur-identityNamespace. A passkey or a password is aCredential, and a session after sign-in is aGrant. Runkubectl -n zeabur-identity get users,credentials,grantson the server to list these objects. See Manage users for operations.
Next, configure Backup and restore, Upgrade and rollback, and Keep an access path that bypasses Zeabur Identity. For daily use, start with Manage users, add GitHub, Google or your own OpenID provider as a sign-in, or register clients so applications such as Grafana or Argo CD can use Zeabur Identity for sign-in.
Troubleshooting
Section titled “Troubleshooting”| Symptom or result | What to do next |
|---|---|
| The browser shows a certificate error or no passkey option | Run mkcert -install in the environment where the browser runs to confirm that it trusts mkcert's CA. Check that the certificate name matches the Issuer's hostname. |
kubectl reports Unauthorized | Check that the configuration in step 5 loaded successfully. kube-apiserver ignores a configuration file with an error until the file changes again. Run sudo journalctl -u k3s | grep -i "authentication config" on the k3s server to find the cause. |
| Port 8000 is already in use | kubelogin uses this port to receive the browser redirect. Change both --listen-address and --oidc-redirect-url. The registered redirect URI accepts any port on 127.0.0.1. |
Clean up
Section titled “Clean up”Uninstall k3s on the server. This removes the entire cluster, Zeabur Identity, and all other resources installed in the cluster:
sudo /usr/local/bin/k3s-uninstall.shrm -rf ~/zeabur-identity-tls ~/authn.yaml ~/zeabur-identity-downloadThen run these commands on your computer:
rm ~/.kube/zeabur-identity-k3s.yamlrm -rf ~/.kube/cache/oidc-login