This is the multi-page printable view of this section. Click here to print.

Return to the regular view of this page.

EKS Control Plane Provisioning (Terraform)

Deploy the required infrastructure - Terraform setup for EKS cluster, IAM roles, and VPC

    Before you Begin

    Ensure that the following points are considered.

    • The AWS CLI is configured.

    • The VPC is configured with at least two private subnets.

    • Terraform is installed.

    • kubectl is installed.

    Configuring the Parameters

    Configure the following parameters in the terraform.tfvars file available in the terraform directory.

    NameDescriptionTypeRequired
    vpc_idExisting VPC ID.stringYes
    vpc_subnet_idsList of private subnet IDs.list(string)Yes
    cluster_nameName of the EKS cluster. Default set to "eks-terraform".stringNo
    aws_regionRegion for the AWS deployment. Default set to "us-east-1".stringNo
    eks_cluster_role_arnExisting IAM role for EKS control plane. Default set to null.stringNo
    eks_node_role_arnExisting IAM role for node group. Default set to null.stringNo

    Deploying Terraform

    Run the following script to deploy the application.

    cd terraform
    terraform init
    terraform apply -auto-approve
    

    Verifying the Installation

    Run the following commands to verify the deployment.

    terraform output
    

    Sample output:

    eks_cluster_name = "eks-terraform"
    eks_cluster_endpoint = "<Endpoint URL>"
    eks_cluster_region = "us-east-1"
    eks_update_kubeconfig_command = "aws eks update-kubeconfig --region us-east-1 --name eks-terraform"
    

    Run the following command to verify the cluster that was created.

    kubectl get nodepools
    

    Sample output:

    NAME              NODECLASS   NODES   READY   AGE
    general-purpose   default     0       True    ...
    system            default     0       True    ...
    

    Updating kubeconfig after Deployment

    After deploying the cluster, update the local kubeconfig to interact with the cluster. The following commands links the kubeconfig command to the new EKS cluster.

    $(terraform output -raw eks_update_kubeconfig_command)