Kubernetes
Connect
Connect Kubernetes from the terminal. Pass --help for the flags Kubernetes accepts, plus --no-browser for headless environments.
polylane cloud connect --provider kubernetesInstall the Polylane agent in your cluster with Helm.
Connect a Kubernetes cluster with the Polylane agent, installed with Helm. The agent registers the cluster with a Polylane API key and opens an outbound Cloudflare Tunnel. You do not paste a kubeconfig and you do not open an inbound port.
- Start the Kubernetes connect flow in Polylane. It creates an API key with the
cloud_accounts:writescope. - Run the Helm command shown in the flow:
helm install polylane oci://ghcr.io/coreplanelabs/charts/polylane-k8s \
--namespace polylane --create-namespace \
--set polylane.apiKey=<API_KEY> \
--set config.cluster_name=<your cluster name>
- The agent registers itself and your cluster appears in Polylane, usually in under a minute.
The chart needs Kubernetes 1.29 or later, and outbound HTTPS to api.polylane.com and to Cloudflare. For production installs, use apiKey.existingSecret (a Kubernetes Secret that you create first) instead of the key on the command line.
Connect Kubernetes from a CI job or any other environment without a browser.
The Kubernetes connection is already pipeline-shaped: the agent installs with Helm and registers the cluster itself, so once you hold an API key there is no console step left.
Prerequisites
- A Polylane API key with the
cloud_accounts:writescope, stored as a pipeline secret. See API keys and OAuth. The guided flow creates this key for you; a key you create yourself works the same. - Helm and credentials for the target cluster in the job.
Install the agent
helm upgrade --install polylane oci://ghcr.io/coreplanelabs/charts/polylane-k8s \
--namespace polylane --create-namespace \
--set polylane.apiKey=$POLYLANE_API_KEY \
--set config.cluster_name=<your cluster name>
helm upgrade --install keeps the job re-runnable, and registration is keyed on the cluster, so repeating the pipeline never duplicates the connection. For production installs, prefer apiKey.existingSecret (a pre-created Kubernetes Secret) over passing the key on the command line.
The agent registers itself and the cluster appears in Polylane, usually in under a minute. If it does not, check the agent pod: kubectl -n polylane get pods and kubectl -n polylane logs -l app.kubernetes.io/name=polylane-k8s -c agent.
Disconnect
Uninstall the release with helm uninstall polylane --namespace polylane, disconnect the cluster in Polylane, then revoke the agent's API key under Settings → API keys.
How it works
Access
The agent pod runs two containers: agent and cloudflared. Polylane reaches the cluster only through the tunnel, and the agent accepts only GET requests to the Kubernetes API. It refuses exec, attach, port-forward, proxy, watch and log streams.
The agent registers once and keeps its state in its own Secret. It identifies the cluster by the UID of the kube-system namespace, so a second install on the same cluster does not add a second connection. It registers again only after the tunnel stays down for about three minutes.
Infrastructure graph
Polylane lists the cluster every 15 minutes. It maps namespaces, nodes, persistent volumes, storage classes, cluster roles and their bindings. In each namespace, it maps deployments, replica sets, stateful sets, daemon sets, jobs, cron jobs, services, ingresses, config maps, service accounts, roles, role bindings, autoscalers, pod disruption budgets, network policies, persistent volume claims, and up to 500 pods. It never reads or syncs Secrets.
Edges show which node runs each pod, which service and ingress serve it, which controller owns it, and which autoscaler controls a workload. A URL in a workload environment variable becomes an edge to the matching resource, also in other clouds. When the same cluster also syncs through Google Cloud as a GKE cluster, the agent data replaces the GKE data.
Every three minutes, Polylane checks that the agent is online. While it is offline, the console shows the cluster as Offline and Polylane skips the sync.
Checks
Twice an hour, Polylane checks the cluster for:
- Crash-looping pods:
CrashLoopBackOff, or five restarts or more. - Containers that the kernel killed for memory (OOMKilled).
- Pods stuck in the Pending phase.
- Nodes that are NotReady or under memory, disk or PID pressure.
A failed check raises an issue, and Polylane starts an investigation for each issue that is severe enough. Polylane also reads node CPU and memory from metrics-server, and the desired, ready and unavailable replicas of deployments, stateful sets and daemon sets.
Investigations
During an investigation, agents get, list and describe objects, read events, read pod logs (also from the previous container), show CPU and memory per pod and node, follow rollout status, and run a diagnosis of a workload. Polylane cannot change the cluster through the agent: the chart grants no write access to Kubernetes objects.
Permissions
The chart creates a ClusterRole with only the get and list verbs. It covers pods and pod logs, nodes, namespaces, services, endpoints, events, config maps, service accounts, volumes and claims, workloads, jobs, ingresses, network policies, autoscalers, pod disruption budgets, RBAC objects, storage classes, metrics-server data and custom resource definitions. It does not include Secrets.
The only other grant is a Role in the polylane namespace. It lets the agent read and update its own state Secret, and nothing else. The agent uses a service account token that expires after one hour.
Troubleshooting
If the cluster does not appear, check the agent pod:
kubectl -n polylane get podskubectl -n polylane logs -l app.kubernetes.io/name=polylane-k8s -c agent- For tunnel problems:
kubectl -n polylane logs -l app.kubernetes.io/name=polylane-k8s -c cloudflared
When the agent exits with code 3, Polylane refused the API key. Code 4 means that registration failed for a reason that a retry does not fix, such as the cloud-account limit of your plan.
Disconnecting
Do these steps in this order:
- Uninstall the release with
helm uninstall polylane --namespace polylane. This removes the agent pods and the Secrets that the chart made. A Secret that you made forapiKey.existingSecretstays. - Disconnect the cluster in Polylane. Polylane stops the sync and removes the tunnel.
- Revoke the agent's API key under Settings → API keys. Disconnecting does not revoke it.
If you disconnect in Polylane while the agent still runs, the agent registers again after a few minutes and the cluster comes back.
Disconnect
Disconnecting stops every sync and check and deletes the credentials Polylane held. Polylane removes what Kubernetes's API lets it remove. The following stays until you remove it yourself:
- Helm release and agent pods in the cluster
polylane cloud disconnect <id>Tools
1Operations agents can perform in threads.
Supported resources
24Resource types that show up in your infrastructure graph.