Skip to main content
Connect your Kubernetes clusters to enable Kai to analyze workloads, optimize resources, and manage cluster operations. Kubernetes connects via cloud provider auto-discovery (for EKS, GKE, and AKS) or a service-account token with cluster endpoint details for self-managed clusters.

Prerequisites

Install Metrics Server before connecting — it is required for pod and node resource metrics:

Supported platforms


Setup


Connection details

The kubeconfig format CloudThinker uses for direct connections:

Required permissions

Minimum (read-only)

Start with the minimum ClusterRole and expand to the full-analysis role only when you need the broader capability set. Never grant write verbs — get, list, and watch are sufficient for all Kai capabilities.

Agent capabilities

Once connected, Kai can inspect and optimize your cluster.

Verify the connection

Example prompts


Troubleshooting

Verify the API server endpoint is accessible from the internet. Check that firewall rules and security groups allow CloudThinker’s IPs. For private clusters, set up VPN or bastion access and confirm the API server certificate is valid.
Verify the service account token is correct. Check that the ClusterRoleBinding is applied and that the token hasn’t expired. Confirm the service account exists in the correct namespace.
Verify Metrics Server is installed by running kubectl top nodes. Check that Metrics Server pods are running and that the metrics.k8s.io API is available.
Verify the ClusterRole includes namespace list permission. Check if RBAC restricts access to certain namespaces and confirm the service account binding is cluster-wide.

Security

  • Least privilege — grant only the permissions the agents need for your use case; start read-only and widen later.
  • Read-only by default — use read-only credentials unless you want agents to make changes through this connection.
  • Rotate credentials — rotate keys and tokens on your normal schedule; CloudThinker picks up the new value when you update the connection.
  • Revoke on offboarding — remove the credential at the provider when you delete a connection or a teammate leaves.
  • Read-only access — never grant write verbs to the CloudThinker service account; get, list, and watch are sufficient for all agent capabilities.
  • Namespace isolation — keep the service account in a dedicated namespace (e.g., cloudthinker) to simplify auditing and revocation.

Kai Agent

Kubernetes-focused optimization agent

AWS Connection

Connect AWS for EKS auto-discovery