Skip to content

Multi-Cluster Inspection (TargetCluster) and Federated Fleet

Faber supports two complementary multi-cluster architectures so you can choose centralized inspection, decentralized autonomous spokes, or both together.

Pattern Topology Network Direction Best For
TargetCluster (ftc) One central Faber operator connects to remote Kubernetes API servers. Hub outbound to remote Kubernetes APIs. Cross-cluster read-only diagnostics, correlating control-plane and workload clusters, small fleets where central kubeconfigs are acceptable.
Federated Fleet (hub / spoke) Independent Faber operators run inside each cluster and sync to a central Hub. Spokes outbound-only to Hub (POST /api/v1/fleet/ingest). Zero inbound ports on spokes. Air-gapped, NAT-ed, or high-security clusters where kubeconfigs must never leave each cluster and every cluster runs its own local LLM, sandbox, and PR loops.

Part 1: Multi-Cluster Inspection with TargetCluster

Section titled “Part 1: Multi-Cluster Inspection with TargetCluster”

The TargetCluster CRD (shortNames: ftc, tcluster) registers a remote Kubernetes cluster in the same namespace as the policies or tool profiles that inspect it.

Each TargetCluster configures exactly one credential source (enforced by a CRD CEL rule):

  1. spec.kubeconfigSecretRef: References a same-namespace Secret containing kubeconfig YAML (default key kubeconfig).
  2. spec.endpoint: Direct API server URL (https:// or http://) paired with bearerTokenSecretRef (required) and optional caSecretRef or insecureSkipTLSVerify.
Terminal window
kubectl -n faber create secret generic eu-west-prod-kubeconfig \
--from-file=kubeconfig=./eu-west-prod.kubeconfig
apiVersion: faberops.dev/v1alpha1
kind: TargetCluster
metadata:
name: eu-west-prod
namespace: faber
spec:
kubeconfigSecretRef:
name: eu-west-prod-kubeconfig
key: kubeconfig
defaultNamespace: production
allowedNamespaces:
- production
- ingress-system
readOnly: true
labels:
region: eu-west-1
env: production
tier: workload

Option B: Direct API Server Endpoint and Bearer Token

Section titled “Option B: Direct API Server Endpoint and Bearer Token”
apiVersion: faberops.dev/v1alpha1
kind: TargetCluster
metadata:
name: us-east-staging
namespace: faber
spec:
endpoint:
server: https://k8s.us-east-staging.example.com:6443
caSecretRef:
name: us-east-staging-auth
key: ca.crt
bearerTokenSecretRef:
name: us-east-staging-auth
key: token
defaultNamespace: staging
allowedNamespaces:
- staging
readOnly: true
labels:
region: us-east-1
env: staging
  • Read-only by default: spec.readOnly defaults to true at runtime whenever omitted.
  • Namespace boundary: spec.allowedNamespaces restricts remote inspection strictly to the listed namespaces. When omitted, access is bounded by the remote credential’s own Kubernetes RBAC.
  • Unconditional Secret block: Remote k8s_get, k8s_list, k8s_logs, and k8s_events calls unconditionally block core v1 Secret access, just like local cluster tools.
  • Automatic credential refresh: The multi-cluster client pool caches remote Kubernetes clients keyed by both TargetCluster resourceVersion and referenced Secret resourceVersion, rebuilding clients automatically whenever you rotate a token or kubeconfig Secret.
  • Same-namespace isolation: targetClusterRefs stay within the referencing resource’s namespace unless --allow-cross-namespace-refs=true (controller.allowCrossNamespaceRefs=true) is explicitly enabled.

Binding Multi-Cluster Scopes to a ToolProfile or MaintenancePolicy

Section titled “Binding Multi-Cluster Scopes to a ToolProfile or MaintenancePolicy”

Reference up to 10 TargetCluster objects via ToolProfile.spec.targetClusterRefs or MaintenancePolicy.spec.targetClusterRefs, then set cluster: <targetcluster-name> on each remote kubernetes tool scope (leaving cluster empty targets the local cluster):

apiVersion: faberops.dev/v1alpha1
kind: ToolProfile
metadata:
name: multicluster-readonly
namespace: faber
spec:
targetClusterRefs:
- name: eu-west-prod
kubernetes:
- apiGroups: [""]
resources: ["pods", "events"]
namespaces: ["production"]
verbs: ["get", "list"]
- cluster: eu-west-prod
apiGroups: [""]
resources: ["pods", "events"]
namespaces: ["production", "ingress-system"]
verbs: ["get", "list"]
- cluster: eu-west-prod
apiGroups: ["apps"]
resources: ["deployments", "statefulsets"]
namespaces: ["production"]
verbs: ["get", "list"]

During a run, the agent passes the optional cluster argument to k8s_get, k8s_list, k8s_logs, and k8s_events to correlate local and remote cluster state in one investigation. See the full runnable manifest at config/samples/targetcluster-remote.yaml.

TargetClusterReconciler probes the remote cluster discovery endpoint and updates status.ready, status.kubernetesVersion, status.lastCheckedAt, and the Ready condition (Connected, SecretNotFound, or ConnectionFailed). Check connectivity with kubectl or faberctl:

Terminal window
kubectl -n faber get targetclusters
faberctl clusters list --namespace faber

Part 2: Outbound-Only Federated Fleet (Hub and Spoke)

Section titled “Part 2: Outbound-Only Federated Fleet (Hub and Spoke)”

In Federated Fleet mode, each cluster runs a full autonomous Faber spoke (fleet.role=spoke). Spokes execute triggers, LLM loops, zero-egress sandboxes, and PR commits locally without exposing any inbound port or sharing kubeconfigs with the Hub.

flowchart LR
SpokeA["Spoke Cluster A (eu-west-1)\nfleet.role=spoke"] -->|"Outbound HTTPS POST /api/v1/fleet/ingest\nBearer FABER_FLEET_TOKEN"| Hub["Central Fleet Hub\nfleet.role=hub"]
SpokeB["Spoke Cluster B (us-east-1)\nfleet.role=spoke"] -->|"Outbound HTTPS POST /api/v1/fleet/ingest\nBearer FABER_FLEET_TOKEN"| Hub
Hub -.->|"Pending approve / reject / pause / resume\nreturned in ingest response"| SpokeA
Hub -.->|"Pending approve / reject / pause / resume\nreturned in ingest response"| SpokeB
Operator["Operator (Web UI / faberctl fleet)"] --> Hub
  1. Shared bearer token (FABER_FLEET_TOKEN): Both Hub and Spokes mount a shared token from an existing Kubernetes Secret (fleet.tokenExistingSecret, default key token) into the FABER_FLEET_TOKEN environment variable. Plaintext tokens are disallowed in values.yaml. The Hub verifies Authorization: Bearer <token> using constant-time SHA-256 comparison.
  2. Periodic spoke push: Every fleet.syncInterval (default 15s), the spoke’s leader-elected SpokeSyncer sends an outbound POST /api/v1/fleet/ingest carrying cluster metadata (clusterId, displayName, region, Kubernetes version, pause state, waiting approval count) and recent run summaries.
  3. Command piggybacking and acknowledgement: The Hub’s ingest response returns any pending commands (approve, reject, pause, or resume) queued for that clusterId. The spoke executes each command locally against its own store and controller, then sends POST /api/v1/fleet/commands/{id}/ack with the execution result.
  4. Staleness detection: A spoke that stops heartbeating for more than 2 minutes is reported stale, and faber_fleet_clusters_online reflects the live online spoke count.

Step 1: Create the Shared Fleet Token Secret

Section titled “Step 1: Create the Shared Fleet Token Secret”

Create the same random bearer token Secret in the Hub namespace and in each Spoke namespace (for example via External Secrets Operator or kubectl):

Terminal window
FLEET_TOKEN="$(openssl rand -hex 32)"
# Run on the Hub cluster and on each Spoke cluster
kubectl -n faber create secret generic faber-fleet-token \
--from-literal=token="$FLEET_TOKEN"
Terminal window
helm upgrade --install faber oci://ghcr.io/faberops/charts/faber \
--version 2.0.0 \
--namespace faber \
--create-namespace \
--set fleet.role=hub \
--set fleet.tokenExistingSecret=faber-fleet-token

For production Hubs tracking many spokes, pair fleet.role=hub with PostgreSQL HA (store.driver=postgres, replicaCount=2) as described in SQLite and PostgreSQL HA.

Terminal window
helm upgrade --install faber oci://ghcr.io/faberops/charts/faber \
--version 2.0.0 \
--namespace faber \
--create-namespace \
--set fleet.role=spoke \
--set fleet.hubUrl=https://hub.faber.example.com \
--set fleet.clusterId=eu-west-prod \
--set fleet.displayName="EU West Production" \
--set fleet.region=eu-west-1 \
--set fleet.syncInterval=15s \
--set fleet.tokenExistingSecret=faber-fleet-token

On HA spokes running PostgreSQL (leaderElection.enabled=true), only the active leader replica runs SpokeSyncer so heartbeats and command acknowledgements are never duplicated.

Point faberctl at your Hub (FABER_API_URL=https://hub.faber.example.com):

Terminal window
# List registered spoke clusters, online/stale status, and waiting approval counts
faberctl fleet clusters
# List aggregated runs across all spokes or filter by cluster and phase
faberctl fleet runs --status WaitingApproval
faberctl fleet runs --cluster eu-west-prod --limit 20
# Queue a remote approval or rejection for pickup on the spoke's next sync tick
faberctl fleet approve eu-west-prod run-01j9abc --reason "approved from central Hub"
faberctl fleet reject eu-west-prod run-01j9abc --reason "hold until maintenance window"
  • Audit log events: fleet.command.queued (recorded on the Hub when a command is queued) and fleet.command.executed (recorded when execution is acknowledged).
  • Prometheus metrics:
    • faber_fleet_clusters_online: Gauge tracking federated spoke clusters currently reporting online.
    • faber_fleet_commands_total{action,status}: Counter tracking queued, acknowledged, and failed fleet commands (approve, reject, pause, resume).