Skip to content

Registering Kubernetes Clusters

Shoehorn discovers Kubernetes workloads through a lightweight agent in each cluster. This guide covers registering a cluster and deploying the agent.

  1. Register the cluster in Shoehorn. This creates the cluster’s agent token.
  2. Deploy the K8s agent to the cluster with that token.
  3. The agent watches workloads and pushes them to Shoehorn.
  4. Shoehorn creates catalog entities for them.
  1. Go to Admin > Integrations > Clusters.
  2. Click Register Cluster.
  3. Fill in:
    • Cluster Name: the label shown in the UI, such as Production EU.
    • Cluster ID: a short slug for the agent install, such as prod-eu. Lowercase letters, numbers and hyphens. Each ID can be registered once in a Shoehorn installation, so if it’s taken, pick another.
    • Description: optional notes.
    • Token Expiration (days): leave it empty for a token that doesn’t expire.
  4. Click Register.
  5. Copy the agent token. It’s shown only once. The dialog also gives you a ready-made Helm command for the cluster.

Use an API key with the k8s-agents:create scope (k8s-agents:write and k8s-agents:admin also work):

Terminal window
curl -X POST https://shoehorn.example.com/api/v1/k8s/agents/register \
-H "Authorization: Bearer <your-api-key>" \
-H "Content-Type: application/json" \
-d '{
"clusterId": "prod-eu",
"name": "Production EU",
"description": "Production cluster in EU",
"expiresIn": 90
}'

expiresIn is in days. Leave it out for a token that doesn’t expire.

Response (201 Created):

{
"token": "sha_xxxxxxxxxxxxxxxxxxxx",
"tokenPrefix": "sha_xxxx",
"clusterId": "prod-eu",
"name": "Production EU",
"expiresAt": "2027-02-24T10:00:00Z",
"createdAt": "2026-11-26T10:00:00Z"
}

The API answers 409 when the cluster ID is already registered, and 402 when your license has no room for another cluster. The Terraform provider’s shoehorn_k8s_agent resource registers clusters the same way.

See Deploying the K8s Agent for the full Helm installation.

Quick install:

Terminal window
helm install shoehorn-k8s-agent oci://ghcr.io/shoehorn-dev/helm-charts/shoehorn-k8s-agent \
--namespace shoehorn --create-namespace \
--set shoehorn.apiURL=https://shoehorn.example.com \
--set shoehorn.apiToken=sha_xxxxxxxxxxxxxxxxxxxx \
--set shoehorn.cluster.id=prod-eu \
--set shoehorn.cluster.name="Production EU" \
--wait

The agent sends a heartbeat while it runs. Admin > Integrations > Clusters shows each cluster’s status from the last one:

Status Meaning
Online Last heartbeat under 8 minutes ago
Degraded Last heartbeat 8 to 15 minutes ago
Offline No heartbeat for 15 minutes or more
Unknown No heartbeat yet, usually because the agent isn’t deployed

By default, the agent watches all namespaces. To leave some out, set agent.kubernetes.excludeNamespaces in the agent’s Helm values:

agent:
kubernetes:
excludeNamespaces:
- kube-public
- kube-node-lease

The Infrastructure tab finds cluster software such as Cilium, cert-manager, Argo CD and Flux among the workloads the agent watches. Excluding kube-system, cert-manager, argocd or flux-system hides that software there.

When the agent discovers a workload, Shoehorn:

  1. Creates a catalog entity if one doesn’t exist.
  2. Sets the entity type from the workload kind, or from the shoehorn.dev/type annotation.
  3. Reads metadata from annotations (see Annotations Reference).
  4. Works out the lifecycle stage from the namespace name.
  5. Tags the entity with the cluster it came from and links the two.

Without a shoehorn.dev/lifecycle annotation, the namespace name decides:

Namespace Lifecycle
kube-system, argocd, flux-system and other system namespaces experimental
Contains prod, such as prod-eu or checkout-prod production
Contains stage or staging staging
Contains dev development
Anything else experimental

Each cluster row in Admin > Integrations > Clusters has an actions menu.

If a token leaks:

  1. Open the cluster’s actions menu and choose Rotate token.
  2. Copy the new token. The old one stops working right away.
  3. Update the agent’s token in the cluster, for example with helm upgrade --reuse-values --set shoehorn.apiToken=<new token>, or by updating the Secret named in shoehorn.existingSecret.

Revoke token in the same menu turns the token off without giving the cluster a new one.

  1. Uninstall the agent from the cluster.
  2. Open the cluster’s actions menu and choose Delete cluster.

Deleting a cluster removes its workloads from Shoehorn. Catalog entities that no longer run in any cluster are removed with them.

Register each cluster separately, one ID per cluster. Pick IDs that read well in the UI:

prod-us
prod-eu
staging
dev

Each agent pushes on its own. Entities are tagged with their source cluster for filtering.