Private clusters with the agent

If your EKS API server only has a private endpoint, KeelPilot cannot reach it directly. The KeelPilot agent runs inside your network, opens a single outbound tunnel to KeelPilot and forwards requests to the API servers of the clusters you allow. No inbound ports are opened, and KeelPilot never initiates a connection into your network.

Usage scenarios

The agent is the same in every case: what changes is where it runs and which clusters are on its allowlist.

One private cluster, agent inside

Diagram: KeelPilot agent inside the private cluster it operatesThe agent runs inside cluster payments-prod and reaches its private API server on TCP 443. It opens an outbound WebSocket tunnel over port 443 to KeelPilot at app.keelpilot.io. No inbound ports are opened in your network.KeelPilotapp.keelpilot.ioYour network (AWS) · no inbound portscluster: payments-prodKeelPilot agentAPI serverprivate API443Outbound tunnel · WSS 443

The simplest case: install the agent in the same cluster you want to operate. It only needs outbound 443 to KeelPilot; the API server stays private.

One agent for several clusters in the same account

Diagram: one KeelPilot agent serving several clusters in the same accountThe agent runs in cluster platform of account 111111111111 and reaches the private API servers of payments-prod and analytics-prod on TCP 443, in the same VPC or in peered VPCs. It opens a single outbound WebSocket tunnel over port 443 to KeelPilot at app.keelpilot.io.KeelPilotapp.keelpilot.ioAccount 111111111111 · one VPC or peered VPCsKeelPilot agentcluster: platformpayments-prodprivate APIanalytics-prodprivate API443Outbound tunnel · WSS 443

When your clusters live in one account, in the same VPC (or in VPCs with peering), one agent serves all of them: list them in its clusters allowlist, or use *. Across VPCs, the agent needs a route to each cluster, TCP 443 from its CIDR on the control plane security group, and a private-only endpoint (see DNS under Transit Gateway below).

Several accounts over Transit Gateway (hub-and-spoke)

Network diagram: KeelPilot agent in the hub accountThe agent runs in cluster platform of hub account 111111111111 and opens an outbound WebSocket tunnel over port 443 to KeelPilot at app.keelpilot.io. From the hub it reaches the private API servers of payments-prod in spoke account 222222222222 and analytics-prod in spoke account 333333333333 through a Transit Gateway on TCP 443.KeelPilotapp.keelpilot.ioYour network (AWS) · no inbound portsHub account · 111111111111KeelPilot agent · cluster: platformTransit GatewayTCP 443Spoke · 222222222222payments-prodprivate APISpoke · 333333333333analytics-prodprivate APIOutbound tunnel · WSS 443

When your clusters are spread across several AWS accounts connected by a Transit Gateway: the agent runs in the hub account and, in each spoke (workload) account, assumes a role that trusts only the agent. Step by step in “Multiple AWS accounts over Transit Gateway” below.

The agent is for EKS. Private GKE clusters don’t need it: KeelPilot reaches them through the GKE DNS endpoint. See Connect Google Cloud.

What it is for

With a connection set to Via agent, everything Kubernetes-related goes through the tunnel: the K8s Explorer, logs, pod shell, the kubectl console, node operations, Helm and the kubeconfig for your local kubectl. EKS, EC2 and CloudWatch calls keep going through the AWS API with the connection’s role. Connection permissions, ACLs and the kubectl console policy are applied before anything reaches the tunnel: the agent is only transport.

Before you start

  • Outbound HTTPS (TCP 443) from the agent’s cluster to app.keelpilot.io. Nothing inbound.
  • A cluster that can reach the API servers you want to operate (with several accounts, typically a cluster in the hub account that reaches the others through a Transit Gateway).
  • Helm 3 and kubectl access to that cluster to install the chart.
  • A Pro plan (up to 2 active agents) or Enterprise (unlimited). The trial allows 2. See Plans & limits.
  • The owner or admin role in the organization: only they can create tokens, run the IAM wizard and change the access mode.

Steps

  1. 1Create a registration token. In Settings → Kubernetes → Agents (clusters with a private endpoint), click Install agent. In step 1 of the 4-step wizard, enter a name and the allowed clusters (comma separated; * = every cluster the agent’s role can see, empty = none) and click Next. The token is single-use and expires in 24 h; the screen shows the helm install command ready to copy.
    Install an agent wizard, step 1 with name and allowed clusters and Next highlighted
  2. 2Generate the IAM permissions. In the same screen, open IAM permissions and cluster access: pick the AWS connection, the cluster where the agent runs, the clusters it will operate, the permission level (Administration = AmazonEKSClusterAdminPolicy, Edit = AmazonEKSAdminPolicy, Read only = AmazonEKSViewPolicy) and how the pod gets credentials (IRSA or EKS Pod Identity). KeelPilot reads each cluster’s authentication mode and gives you CloudFormation, a CLI script and optional Terraform. Clusters in API or API_AND_CONFIG_MAP get an access entry; clusters in CONFIG_MAP get the aws-auth mapping (with a backup) in the CLI tab. KeelPilot only reads your account: it creates nothing.
    Install an agent wizard, step 2 IAM permissions with connection, clusters, permission level and credentials, and Generate highlighted
  3. 3Install the agent with the helm install from step 1 (or the complete one from the IAM wizard, which already includes the service account and, with IRSA, the role annotation).
  4. 4Check that it shows “Connected” in the agents list, with its version, last contact and the clusters it serves.
    Agents list with a connected agent, its version, last seen and the clusters it serves
  5. 5Switch the connection to “Via agent”. In Settings → Kubernetes → Kubernetes access per connection, set the AWS connection to Via agent and choose the agent. Direct (the default) uses the public endpoint.
    Kubernetes access per connection with Direct and Via agent modes
  6. 6Verify with the explorer: open the cluster in the K8s Explorer and check that namespaces, pods and logs load.
    Kubernetes Explorer on a cluster reached through the agent, listing pods
helm install keelpilot-agent oci://ghcr.io/sanroll/charts/keelpilot-agent \
  --namespace keelpilot --create-namespace \
  --set keelpilot.url=https://app.keelpilot.io \
  --set registro.token=<REGISTRATION_TOKEN> \
  --set nombre=platform \
  --set clusters='{payments-prod,analytics-prod}' \
  --set regiones='{us-east-1}'

How to verify

  • The agent shows Connected and lists the expected clusters under Clusters it serves.
  • The K8s Explorer shows namespaces, pods and live logs for the private cluster.
  • From your laptop, with a KeelPilot kubeconfig, kubectl get nodes answers through the tunnel.
  • If something fails, the agent logs explain why: kubectl -n keelpilot logs deploy/keelpilot-agent.

Multiple AWS accounts over Transit Gateway

One agent in the hub account (the central network account) can serve clusters in spoke accounts (workload accounts). In each spoke account the agent assumes a role (keelpilot-agent-acceso) that trusts only the agent’s role in the hub. Full example with Acme:

Acme has a hub account 111111111111 with cluster platform (VPC 10.10.0.0/16, with internet egress) and two spoke accounts: 222222222222 with payments-prod and 333333333333 with analytics-prod, both in us-east-1 with a private endpoint, reachable from the hub through a Transit Gateway.

1. Network

  • Transit Gateway: attachments for the three VPCs and routes both ways (hub VPC → each spoke CIDR, and each spoke → 10.10.0.0/16). If the TGW belongs to another account, share it with RAM.
  • Control plane security group of each spoke cluster (resourcesVpcConfig.clusterSecurityGroupId): ingress TCP 443 from 10.10.0.0/16. The wizard generates it.
  • DNS: with a private-only endpoint nothing is needed — EKS public DNS already returns the endpoint’s private IPs. With a public + private endpoint, the name resolves to public IPs from the hub and traffic does not go through the TGW; the wizard detects it and, in that account’s DNS tab, proposes switching to private only (recommended) or a Route 53 Resolver INBOUND endpoint in the spoke plus a FORWARD rule in the hub.

2. Permissions (IAM wizard, step 6)

Choose the hub account’s connection, agent cluster platform, level and method. Step 6 is where you add the spoke accounts; the app currently labels it “Vertical accounts”. Enter the hub VPC CIDR 10.10.0.0/16 (field “Core VPC CIDR”) and one account per spoke, each with its own KeelPilot AWS connection (the wizard reads DescribeCluster with it) or, if it does not exist yet, the data entered manually. You get one tab per account:

  • Hub account (111111111111, tab “Core”) — deploy FIRST: role keelpilot-agent-platform (IRSA or Pod Identity) with eks:ListClusters, eks:DescribeCluster and sts:AssumeRole (+ sts:TagSession with Pod Identity) only on arn:aws:iam::222222222222:role/keelpilot-agent-acceso and arn:aws:iam::333333333333:role/keelpilot-agent-acceso.
  • 222222222222 and 333333333333, deployed with each account’s credentials: role keelpilot-agent-acceso whose trust admits only arn:aws:iam::111111111111:role/keelpilot-agent-platform (with sts:ExternalId if you set one), the access entry of that role on each cluster with the chosen level (or aws-auth if the cluster is CONFIG_MAP) and the 443 rule from the hub VPC on the control plane security group (parameter CidrCore in CloudFormation). Available as CloudFormation, CLI or Terraform.
The spoke roles’ trust points to the ARN of the agent’s role in the hub, and IAM rejects a principal that does not exist, so the hub goes first. If that role is deleted and recreated, save the spoke roles’ trust again (IAM stores it by internal id).

3. Install the agent (once, in platform)

cat > keelpilot-agent-cuentas.yaml <<'EOF'
cuentas:
  - id: "222222222222"
    rolArn: arn:aws:iam::222222222222:role/keelpilot-agent-acceso
    regiones: [us-east-1]
    clusters: [payments-prod]
  - id: "333333333333"
    rolArn: arn:aws:iam::333333333333:role/keelpilot-agent-acceso
    regiones: [us-east-1]
    clusters: [analytics-prod]
EOF
helm install keelpilot-agent oci://ghcr.io/sanroll/charts/keelpilot-agent \
  --namespace keelpilot --create-namespace \
  --set keelpilot.url=https://app.keelpilot.io \
  --set registro.token=<REGISTRATION_TOKEN> \
  --set nombre=platform \
  --set 'regiones={us-east-1}' \
  -f keelpilot-agent-cuentas.yaml \
  --set serviceAccount.name=keelpilot-agent \
  --set-string 'serviceAccount.annotations.eks\.amazonaws\.com/role-arn=arn:aws:iam::111111111111:role/keelpilot-agent-platform'

Without its own clusters list the agent does not serve the hub account’s clusters (add --set 'clusters={platform}' if you want it to). The agent logs show clusters servidos with us-east-1/payments-prod and us-east-1/analytics-prod, and the agents list shows the clusters with their ARNs (arn:aws:eks:us-east-1:222222222222:cluster/payments-prod, …).

4. Connections in KeelPilot

Add one AWS connection per spoke account (KeelPilotAccessRole in 222222222222 and in 333333333333, each with its ExternalId) for what goes through the AWS API (EKS, EC2, CloudWatch, node groups). In Settings → Kubernetes → Kubernetes access per connection, set both to Via agent with the same agent platform. The connection’s account does not need to match the agent’s: the agent belongs to the same organization and each cluster is identified by its ARN, which includes the account.

5. Verify

  • In KeelPilot, each spoke cluster shows namespaces, pods and logs, all through the tunnel.
  • From a laptop, download the kubeconfig of the 222222222222 connection and run kubectl --kubeconfig ./kubeconfig-payments-prod.yaml get nodes: the request goes to KeelPilot, which applies ACLs and policy and sends it through the agent in the hub to the private API server.

High availability

Diagram: two agent replicas with leader electionTwo agent replicas run in cluster platform. Replica 1 is the leader and holds the outbound WebSocket tunnel over port 443 to KeelPilot at app.keelpilot.io. Replica 2 waits on the Lease and takes over the tunnel in about 5 seconds if the leader goes down.KeelPilotapp.keelpilot.ioYour network (AWS) · no inbound portscluster: platformReplica 1leader · holds the tunnelReplica 2standby (Lease)Outbound tunnel · WSS 443takes over ~5 s

This is the default (replicaCount: 2, leaderElection.enabled: true): use it in any scenario above, nothing to configure.

The chart runs 2 replicas with leader election; only the leader holds the tunnel. If the leader goes down, the other replica takes the lease in about 5 seconds. New requests made meanwhile wait up to 15 seconds for the tunnel to come back before failing.

Security

  • Outbound only: the agent opens a WebSocket over 443 to KeelPilot. KeelPilot never connects into your network.
  • Allowlist: the agent only forwards to clusters on its list, using its own IAM role. The destination host always comes from DescribeCluster, never from the request, and only Kubernetes API paths are allowed.
  • The agent signs its own EKS token and drops any Authorization, Cookie or Impersonate-* header coming from KeelPilot. It runs as non-root with a read-only filesystem and logs no secrets or bodies.
  • Rotate credential and Revoke from the agents list. A revoked agent does not retry: create a new token and run helm upgrade. Reinstalling with the same name replaces the previous registration and does not count as a new agent.

Reconnections and open streams

The tunnel reconnects in three situations, and open streams (live logs, pod shell, kubectl logs -f, kubectl get -w) behave like this:

  • Credential rotation: the agent opens a new tunnel before releasing the old one. Open streams keep running on the old tunnel until they finish (up to 10 minutes); new requests go to the new one. Nothing is cut.
  • KeelPilot deploy: the agent is asked to move to a new tunnel and the old instance waits for open streams to finish before shutting down. A stream that is still open when the drain window ends is closed.
  • Agent leader pod goes down: whatever was running through that pod is lost. Live logs in the UI reconnect on their own from the last line received (“Reconnecting…”); the pod shell offers Reconnect and retries once — it is a new session.

When a stream does get cut, kubectl get -w and kubectl logs -f do not retry: run them again (logs -f --since=1m to avoid losing lines). Tools built on client-go informers (k9s, Lens, Headlamp) re-watch on their own.

Troubleshooting

The agent never shows “Connected”.

Cause: Outbound 443 to app.keelpilot.io is blocked, or the registration token was already used or expired (24 h): the agent logs “Registration token is invalid, used or expired”.

Fix: Open egress on 443 (security groups, NACLs, proxy, firewall) and check with kubectl -n keelpilot logs deploy/keelpilot-agent. If the token expired or was used, create a new one and reinstall.

Creating the token or registering fails with a plan limit error.

Cause: Your plan’s active agent limit is reached (Pro: 2).

Fix: Revoke an agent you no longer use or upgrade to Enterprise. Reinstalling with the same name does not count as a new agent.

403 “This connection’s agent does not serve that cluster”.

Cause: The cluster is not on the agent’s allowlist, or its role cannot see it.

Fix: Add it to the chart’s clusters list (or use *) and run helm upgrade; check the role’s eks:DescribeCluster permission.

503 “This connection’s agent is not connected”.

Cause: The agent pods are down or cannot reach KeelPilot.

Fix: Check kubectl -n keelpilot get pods and the agent logs.

Multi-account: a spoke account shows no clusters or times out.

Cause: ListClusters failing in the spoke account = trust of keelpilot-agent-acceso or the sts:AssumeRole of the agent’s role in the hub. Timeout to the API server = TGW route, the 443 rule or DNS. A 401 from the API server = missing access entry for keelpilot-agent-acceso.

Fix: Fix the piece the agent log points to. To check DNS, resolve the endpoint host from a pod in the hub cluster: it must return private IPs of the spoke.