Agent Federation
Without agent federation, the manifests of a self-hosted Kargo agent carry long-lived tokens for your Kargo instance and its linked Argo CD instance. Anyone who copies them from the cluster, a backup or a leaked manifest can use them from anywhere, until the credentials are rotated, to:
-
Read the Git, image registry and other credentials stored in your Kargo projects.
-
Change the state of the shard's Stages, Freight and Promotions.
-
Change Applications in the linked Argo CD instance.
With agent federation, the agent uses short-lived service account tokens issued by its own cluster instead. The Akuity Platform verifies them against the cluster's OIDC issuer and accepts them only for the agent's service accounts.
Agent federation is enabled per organization. Contact Akuity Support to enable it.
Requirements
-
A self-hosted agent. Akuity-managed agents are not supported.
-
Akuity Agent 0.5.107 or later.
-
Kargo 1.9.17-ak.1, 1.10.17-ak.1, 1.11.10-ak.1, 1.12.6-ak.1 or later.
Limitations
Once enabled, agent federation can't be turned off, and its settings and the agent namespace can't be changed. To change them, delete the agent, register it again and re-apply the manifests. Check the values carefully before saving.
This is for safety: if the settings could be edited or federation turned off, anyone allowed to update the agent could trust their own keys or service accounts, or get new long-lived tokens issued.
The agent still uses a static password for its tunnel, a connection from the cluster to the control plane that the agent uses to send data. It can't read or change anything sensitive.
Finding the issuer and keys
In the cluster where the agent runs, type:
kubectl get --raw /.well-known/openid-configuration
Use the issuer field as the Issuer, then choose a Key Source:
-
Discover from issuer: For issuers whose discovery document and keys are public over HTTPS, such as EKS, GKE and AKS with the OIDC issuer enabled.
-
JWKS URL: For keys served at another public HTTPS URL.
-
Paste JWKS: For private clusters, such as on-premises, k3s or kind. Paste the output of
kubectl get --raw /openid/v1/jwks.
The keys must be fetchable when you save. Discovered keys and keys from a URL are refreshed regularly. Pasted keys never are, so use them only if the cluster doesn't rotate its signing key.
Promotion service accounts
Stages that set a custom promotion service account with the ee.kargo.akuity.io/promotion-sa annotation need it listed in Promotion Service Accounts, or their promotions fail once the agent is federated. Up to 20 accounts can be listed, except default, the agent's own accounts and accounts allowed for analysis Jobs.
Enabling agent federation
For a new agent, go to Kargo → your instance → Agents → + Register an agent. For an existing agent, click its edit button under Actions. The agent must be connected and no credential rotation may be in progress. Then:
-
Under Advanced settings, select the Security tab and turn on Agent Federation.
-
Enter the Issuer, choose a Key Source and add any Promotion Service Accounts.
-
Click Connect for a new agent, or Save for an existing one.
On an existing agent, saving rotates its credentials once. If Auto Upgrade is disabled, re-apply the manifests. The old tokens keep working until the agent connects with federated tokens, and are then removed.
Declarative management
Add a federation block to the Kargo agent spec:
apiVersion: kargo.akuity.io/v1alpha1
kind: KargoAgent
metadata:
name: my-agent
spec:
data:
size: small
federation:
issuer: https://oidc.eks.us-west-2.amazonaws.com/id/EXAMPLE
# Optional, set at most one. With neither, keys are discovered from the issuer.
# jwksUrl: https://example.com/keys
# jwks: '{"keys": [...]}'
promotionServiceAccounts:
- kargo-promoter
enabled can be left out, and enabled: false is refused. After federation is enabled, different settings are refused and leaving the block out keeps the stored ones.
Troubleshooting
| Error | What to do |
|---|---|
agent federation feature is not enabled | Contact Akuity Support. |
agent federation is not supported by this version | Upgrade Kargo or select agent version 0.5.107 or later, as the message says. |
not available for Akuity-managed agents | Use a self-hosted agent. |
the agent has not connected yet | Wait for the agent to connect, or re-create the agent with agent federation enabled. |
credential rotation in progress | Wait for the agent to apply the rotation. |
cannot be changed or disabled once enabled or agent namespace cannot be changed | Delete the agent, register it again and re-apply the manifests. |