> ## Documentation Index
> Fetch the complete documentation index at: https://docs.aviatrix.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Onboard Kubernetes Clusters

> Onboard Kubernetes Clusters

After your Kubernetes Clusters have been discovered as part of your AWS or Azure
cloud account onboarding, you onboard the clusters from the Cloud Resources >
Cloud Assets > Kubernetes Clusters tab.

You can onboard Azure clusters manually or via a preconfigured kubeconfig file.

You can onboard AWS clusters manually or via an authentication method.

<Note>
  Contact [Support](https://support.aviatrix.com) to enable Aviatrix Kubernetes
  Firewall.
</Note>

## Onboard a Cluster Manually

Onboard a Kubernetes cluster to the Aviatrix PaaS console manually if you built
it without using AKS or EKS. These clusters are not discoverable at the cloud
service provider and are therefore not displayed on the Kubernetes Clusters tab
until you onboard them.

<Note>
  You cannot manually onboard non-cloud based Kubernetes clusters.

  Ensure that the
  [necessary permissions](/docs/cloud/platform-administration/kubernetes/kubernetes-prerequisites)
  are configured in your kubeconfig file before onboarding.
</Note>

1. On the Cloud Resources > Cloud Assets > Kubernetes Clusters tab, click
   *Manually Onboard a Cluster*.

2. In the Manually Onboard a Cluster dialog, enter the following information:

   | Field | Description |
   | - | - |
   | Name | A custom name for the Cluster. |
   | Cloud | AWS or Azure |
   | Cloud Account | Select the AWS or Azure cloud account where Kubernetes clusters were discovered. |
   | Region | Select the region related to the above. |
   | VPC/VNet | Select the VPC/VNet related to the above. |
   | Kubeconfig file | Select the kubeconfig file that provides access to the cluster. If the kubeconfig is not configured correctly you will be unable to manually onboard the cluster.<br /><br />See [Kubernetes Prerequisites](/docs/cloud/platform-administration/kubernetes/kubernetes-prerequisites#kubeconfig-file) for the proper configuration of a kubeconfig file. |

3. Click *Onboard*.

## Onboard a Cluster via Authentication Method (AWS only)

Select this option to onboard clusters created with AWS (EKS) and managed by
your cloud provider. Onboarding via authentication method gives the Aviatrix
PaaS console permissions to query the status of the cluster.

Since these clusters were created with AWS (EKS) they are displayed on the
Kubernetes Clusters tab after you onboard an AWS account that contains
Kubernetes clusters.

To onboard an AWS (EKS) cluster using an authentication method:

1. On the Cloud Assets > Kubernetes Clusters tab, click *Onboard* next to a
   discovered AWS (EKS) Kubernetes cluster.

2. In the Onboard Cluster dialog, select one of the following onboarding
   methods:

   * [Terraform](#terraform)
   * [Command Line](#command-line)
   * [Kubeconfig File](#upload-kubeconfig-file)

   See below for the configuration steps for each method.

3. Click *Onboard*.

### Terraform

<Note>
  The [Terraform
  prerequisites](/docs/cloud/platform-administration/kubernetes/kubernetes-prerequisites#terraform)
  must be met before attempting to onboard clusters using Terraform.
</Note>

After selecting the Terraform option in the Onboard Cluster dialog, the
Terraform script is generated and shown in the Onboard Cluster dialog.

1. Copy the Terraform script text to your clipboard.

2. Paste the Terraform script into the main.tf file.

3. Edit the script to point to the credentials in the providers.tf file.

   Provider information for AWS (EKS) and Kubernetes must be in this file.

4. Run `terraform init` within the Terraform directory.

5. Run `terraform apply` within the Terraform directory.

6. Go back to
   [Onboard a Cluster via Authentication Method (AWS only)](#onboard-a-cluster-via-authentication-method-aws-only)
   to complete the onboarding process.

7. Check AWS to see creation/updating of resources for Kubernetes.

### Command Line

<Note>
  The [eksctl and kubectl
  tools](/docs/cloud/platform-administration/kubernetes/kubernetes-prerequisites)
  must be installed before attempting to onboard clusters using Command Line.
</Note>

After selecting the Command Line option, the Command Line script is generated
and shown in the Onboard Cluster dialog.

1. In the Onboard Cluster dialog, copy the first section of the command to the
   clipboard.

   <img src="https://mintcdn.com/aviatrix-14b37c43/Edj7hoOEnFtUHgGn/docs/cloud/images/k8s-onboarding-command-line1.png?fit=max&auto=format&n=Edj7hoOEnFtUHgGn&q=85&s=b703bcb34027ddf80581078b506ec826" alt="k8s-onboarding-command-line1" width="520" height="206" data-path="docs/cloud/images/k8s-onboarding-command-line1.png" />

2. Paste the command into eksctl.

3. Apply the configuration in eksctl to create the accessentry.yaml file (you
   can copy this from the Onboard Cluster dialog):

   ```
   eksctl create accessentry -f accessentry.yaml
   ```

4. In the Onboard Cluster dialog, copy the cluster-role.yaml command.

   <img src="https://mintcdn.com/aviatrix-14b37c43/Edj7hoOEnFtUHgGn/docs/cloud/images/k8s-onboarding-command-line2.png?fit=max&auto=format&n=Edj7hoOEnFtUHgGn&q=85&s=60563d2caf46792ffbe617006fa487cc" alt="k8s-onboarding-command-line2" width="718" height="286" data-path="docs/cloud/images/k8s-onboarding-command-line2.png" />

5. Paste the command into kubectl.

   <Note>
     If desired, you can run the `kubectl config` command now to make sure you
     are in the correct cluster before applying the configuration.
   </Note>

6. Apply the configuration in kubectl to create the cluster-role.yaml file (you
   can copy this from the Onboard Cluster dialog). This gives the Aviatrix
   console permission to view the individual nodes in the cluster.

   ```
   kubectl apply -f cluster.role.yaml
   ```

7. Go back to
   [Onboard a Cluster via Authentication Method (AWS only)](#onboard-a-cluster-via-authentication-method-aws-only)
   to complete the onboarding process.

### Upload Kubeconfig File

<Note>
  Ensure that the kubeconfig file has the [proper
  permissions](/docs/cloud/platform-administration/kubernetes/kubernetes-prerequisites#kubeconfig-file)
  before attempting to onboard the cluster.
</Note>

1. In the Onboard Cluster dialog, select the kubeconfig file to upload.
2. Click *Onboard*.

### Azure

If you are onboarding an Azure (AKS) cluster, you authenticate its configuration
by uploading a kubeconfig file.

## Onboard an Azure (AKS) Cluster

1. On the Cloud Assets > Kubernetes Clusters tab, click *Onboard* next to a
   discovered Azure (AKS) Kubernetes cluster.

2. In the Onboard Cluster dialog, select one of the following:
   * Permissions on Cloud Account: Select if you have configured RBAC
     authentication for your AKS cluster in your Azure cloud account.
   * Kubeconfig File: Select a kubeconfig file to upload. Ensure that the
     kubeconfig file has the
     [proper permissions](/docs/cloud/platform-administration/kubernetes/kubernetes-prerequisites#kubeconfig-file)
     before attempting to onboard the cluster.

3. Click *Onboard*.

You can now create Kubernetes SmartGroups.

## Edit a Kubernetes Cluster

You can only edit the name of manually onboarded Kubernetes clusters.

## Related Topics

* [Aviatrix Kubernetes Firewall](/docs/cloud/platform-administration/kubernetes/kubernetes-overview)
* [Create a Kubernetes SmartGroup](/docs/cloud/resource-groups/smartgroup/smartgroup-kubernetes)
* [Offboard a Kubernetes Cluster](/docs/cloud/platform-administration/kubernetes/kubernetes-offboard)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.