kubectl against it through Ankra. Ankra mints a short-lived token and points your kubeconfig at the Ankra API proxy, which forwards your requests through the agent to the cluster’s API server. You never need direct network access to the cluster, and there are no static credentials to manage.
This works for clusters that have no public API endpoint at all. Because the agent dials out to Ankra (no inbound ports), the proxy reaches private clusters that
kubectl could never hit directly.Prerequisites
- The access gateway is enabled for your deployment. When it isn’t, the token and proxy endpoints return
404. - The cluster has a connected Ankra agent. Every request flows through the agent, so
kubectlstops working while the cluster is offline and resumes when it reconnects. - You have a Cluster Access grant on the cluster. Without one,
ankra cluster kubeconfig addandankra cluster kube-tokenfail with “You do not have access to this cluster”. This applies to organisation admins too - managing access does not itself include kubectl access, so admins must grant themselves a role first. - The grant has reconciled to
applied. A token can be minted as soon as the grant exists, butkubectlreturnsForbiddenuntil the RBAC is live on the cluster - check withankra cluster access listor the cluster’s Access view. - Ankra CLI v0.3.0 or later for the
kubeconfigandkube-tokencommands (runankra upgradeto update). - Sandbox clusters do not support Cluster Access and cannot be reached this way.
How it works
- Your kubeconfig server URL points at
…/api/v1/clusters/{cluster_id}/k8son the Ankra API host - not at the cluster directly. - Each request carries a short-lived token. Ankra authenticates it, checks your access grant, and forwards the call over NATS to the agent, which executes it against the API server.
- Standard
kubectlbehaviours work through the proxy, includingwatch,kubectl logs -f, andkubectl exec(these use streaming/websocket connections).
view grant can’t mutate anything, a namespace-scoped grant can’t see other namespaces.
With the Ankra CLI (recommended)
The CLI manages the Ankra entries in your kubeconfig for you. By default it writes an exec-based context that fetches a fresh token on demand viaankra cluster kube-token, so credentials stay ephemeral and SSO-backed.
1
Log in once
2
Add a cluster context
3
Use kubectl as normal
--kubeconfig if given, otherwise the first entry of $KUBECONFIG, otherwise ~/.kube/config.
ankra cluster kubeconfig commands
add flags
Remove a context
From the portal
You can also generate a kubeconfig from a cluster’s Access view in the portal. Ankra mints a short-lived token and returns a ready-to-use kubeconfig document with the proxy server URL and token already filled in. Save it and pointkubectl at it:
Tokens, expiry, and rate limits
- Short-lived tokens. Both the exec-plugin token and the embedded kubeconfig token are time-boxed and expire automatically. The response includes an
expires_at. - Rate limited. Token and kubeconfig minting is rate limited per user; on large fleets prefer the default exec mode (which mints once) over
--embed-token --all(which mints one token per cluster). - Revocable. An admin can revoke a member’s access at any time from Cluster Access (delete the grant, or revoke all). Existing tokens stop working.
API
These are the token-authenticated user-API paths the CLI uses. The portal manages the same access through session-authenticated endpoints under
/org/clusters/{cluster_id}/access/... - see the Cluster Access API table.
The proxy requires the access gateway to be enabled; when it isn’t, these endpoints return 404. See Cluster Access for grants and the CLI reference for the full command set.