Skip to main content

Overview

Onboarding a Kubernetes cluster creates a cluster configuration on the Aviatrix Controller that grants read-only access to discover Kubernetes namespaces, services, pods, endpoint slices, and nodes. This data powers SmartGroup-based security policies in the Distributed Cloud Firewall (DCF), letting you write firewall rules that reference Kubernetes workloads by label, namespace, or service name. Two things must happen before DCF can enforce policy on a cluster:
  1. Grant Controller access to the cluster’s Kubernetes API — the Controller must be able to reach the API server and authenticate with sufficient RBAC permissions.
  2. Register the cluster — tell the Controller which cluster to watch by completing the onboarding workflow in the UI or via Terraform.

Onboarding Paths

The Kubernetes Clusters tab is only visible when DCF is enabled and Kubernetes Resource Discovery is turned on under Groups > Settings. See Kubernetes Resource Discovery for setup instructions.

Prerequisites

Platform Requirements

Before onboarding any cluster, confirm the following:
  • DCF is enabled. See Enable Distributed Cloud Firewall .
  • Kubernetes Resource Discovery is enabled under Groups > Settings. See Kubernetes Resource Discovery .
  • The Kubernetes API server must be network-reachable from the Controller.
    • Public clusters: restrict API server access to the Controller’s IP address for security.
    • Private clusters: a private network path is required. See Onboarding Private Kubernetes Clusters .
  • SNAT must be disabled on worker nodes so that pod source IPs are preserved for policy enforcement. See the AWS documentation on external SNAT.
  • Flat networking is recommended (this is the default for EKS and AKS). Overlay networks have limited SmartGroup support.
When a cluster uses an overlay network, only Service-type SmartGroups are supported. These SmartGroups can only be used as the destination in DCF rules, and they only control connections through the Load Balancer.

IAM Permissions

The Controller’s cloud account must include the following permissions for cluster discovery and node-level enforcement.
Discovery
  • eks:ListClusters
  • eks:DescribeCluster
  • elasticloadbalancing:DescribeLoadBalancers
  • elasticloadbalancing:DescribeTags
SmartGroup node enforcement
  • ec2:DescribeSecurityGroups
  • ec2:DescribeInstances

Kubernetes RBAC

The AWS-managed AmazonEKSViewPolicy grants read access to most Kubernetes resources but does not include nodes. A supplemental ClusterRole is required so the Controller can discover node metadata for SmartGroup enforcement. Create a file called cluster-role.yaml with the following content:
Apply it to your cluster:
This ClusterRole and ClusterRoleBinding can also be managed as Terraform resources using kubernetes_cluster_role and kubernetes_cluster_role_binding, which is useful for automated or multi-cluster deployments.

Kubeconfig Requirements

When onboarding via kubeconfig file, the file must meet the following requirements:
  • Allowed verbs: GET, LIST, and WATCH on namespaces, services, pods, nodes, and endpointslices.
  • No exec-based authentication — the kubeconfig must not rely on exec plugins (such as aws eks get-token) because the Controller cannot execute external binaries.
  • No create, update, or delete permissions — the Controller only needs read access.
  • Exactly one cluster, user, and context — multi-context kubeconfig files are not supported.
  • Inline credential data only — use certificate-authority-data, client-certificate-data, and client-key-data (base64-encoded) rather than file path references (certificate-authority, client-certificate, client-key, tokenFile). The Controller cannot read files from the local filesystem.
apiVersion: v1 kind: Config clusters: - name: my-cluster cluster:

Understanding the Access Model

Each cloud provider has its own authentication and authorization layers between the Aviatrix Controller and the Kubernetes API server. Before configuring access, it helps to understand what each layer does and why it is required.
EKS access requires two layers working together:The Controller authenticates to EKS by requesting a short-lived STS token on each API call. There is no long-lived credential to rotate.Once both layers are in place, register the cluster so the Controller begins discovering Kubernetes resources.What is the Controller’s IAM role ARN?The Controller authenticates to AWS using the aviatrix-role-app IAM role from the AWS account you onboarded in CoPilot. The ARN follows this format:
This is the same IAM role the Controller uses for all AWS API operations (launching gateways, managing route tables, and so on). You can find the role ARN in two places:
  • CoPilot: navigate to Cloud Resources > Cloud Account and locate the AWS account. The role ARN is listed in the account details.
  • AWS IAM Console: search for aviatrix-role-app under Roles.

Onboarding via Terraform

Terraform provides the most complete and repeatable onboarding path. A single terraform apply can grant Controller access and register the cluster in one step.
EKS requires an EKS Access Entry (IAM layer) and a Kubernetes ClusterRole (RBAC layer), followed by cluster registration. The configuration below handles all three.Requires the aws, kubernetes, and aviatrix Terraform providers configured for the target cluster.
The cluster_id must be the full EKS ARN — for example, arn:aws:eks:us-east-2:123456789012:cluster/my-cluster.

Custom or Self-Managed Clusters

For clusters built with kops, kubeadm, k3s, Rancher, or similar tools, provide a kubeconfig and cluster details:

Multi-Cluster Automation

Use for_each to onboard multiple clusters in a single apply:

Onboarding via CoPilot UI

For clusters discovered via cloud APIs, navigate to Cloud Resources > Cloud Assets > Kubernetes Clusters and click Onboard next to the cluster.
The Onboard Cluster dialog offers three options:
  1. Terraform — Displays generated HCL for the EKS access entry and RBAC resources. Copy the script, apply it with terraform apply, check the confirmation box, then click Onboard.
  2. Command Line — Displays generated eksctl YAML and kubectl YAML. Apply both configurations, check the confirmation box, then click Onboard.
  3. Upload Kubeconfig — Upload a kubeconfig file that meets the kubeconfig requirements. Click Onboard.
Options 1 and 2 handle both granting access and registration in one flow. Option 3 assumes the kubeconfig already has sufficient permissions.

Manual Onboarding

Use manual onboarding when the cluster was built with kops, kubeadm, k3s, Rancher, or similar tools, or when the cluster is not discoverable via cloud APIs.
The cluster must reside in a VPC/VNet in a supported cloud (AWS, Azure, or GCP). On-premises bare-metal clusters cannot be onboarded.
Navigate to Cloud Resources > Cloud Assets > Kubernetes Clusters and click Manually Onboard a Cluster. Click Onboard.

Onboarding via CLI (AWS Only)

If you prefer CLI tools over Terraform, the following methods grant Controller access to an EKS cluster and prepare it for onboarding. After completing any of these methods, register the cluster through the CoPilot UI or Terraform.
Step 1 — Create the EKS access entry. Save the following as accessentry.yaml, replacing the placeholder values:
Apply it:
Step 2 — Create the Kubernetes RBAC. Apply the cluster-role.yaml from the Kubernetes RBAC section:
Tool installation:
Step 1 — Create the EKS access entry:
Step 2 — Associate the EKS view policy:
Step 3 — Create the Kubernetes RBAC for node access:
Use the cluster-role.yaml from the Kubernetes RBAC section.
CloudFormation can manage the EKS access entry. Save the following as aviatrix-eks-access.yaml:
Deploy the stack:
Then associate the access policy via CLI (CloudFormation may not support AWS::EKS::AccessPolicyAssociation):
Finally, create the Kubernetes RBAC:
Method comparison:

Post-Onboarding

Verifying Onboarding Status

After onboarding, the cluster status on the Kubernetes Clusters tab transitions through:

Creating Kubernetes SmartGroups

Once the cluster status is Yes, you can create SmartGroups from Kubernetes resources. Quick creation from the Kubernetes Clusters tab:
  1. Click Create SmartGroup on an onboarded cluster.
  2. Choose One SmartGroup per Namespace or One SmartGroup per Service.
  3. Select the namespaces or services to include.
  4. Click Create.
SmartGroup filter properties:
Service and Label filters cannot be combined in the same SmartGroup rule.
Kubernetes SmartGroups can be used as source or destination in DCF rules like any other SmartGroup.

Editing and Offboarding

Editing a Cluster

You can only edit the name of manually onboarded clusters.

Offboarding a Cluster

Offboarding removes the cluster configuration from the Controller. Resource discovery stops and SmartGroup resources are no longer updated.
  • CoPilot UI: Click Offboard next to the cluster and confirm.
  • Terraform: Remove the aviatrix_kubernetes_cluster resource and run terraform apply.
You cannot offboard a cluster that is referenced by SmartGroups. Remove the SmartGroup references first.
Offboarding does not remove EKS access entries, Kubernetes ClusterRoles, ClusterRoleBindings, or any IAM resources. Clean those up separately if they are no longer needed.

Troubleshooting