EKS Cluster Creation on AWS Cloud

EKS Cluster Creation on AWS Cloud

·

3 min read

Table of contents

No heading

No headings in the article.

Follow the steps below to create an EKS Kubernetes Cluster on AWS Cloud:

  1. Create a New Cluster Go to the following link to create a new cluster: AWS EKS Console

  1. Create Cluster Role Follow these steps to create a cluster role:

    1. Open the IAM console at IAM Console.

    2. Choose Roles, then Create role.

    3. Under Trusted entity type, select AWS service.

    4. From the Use cases for other AWS services dropdown list, choose "EKS".

    5. Choose "EKS - Cluster" for your use case and then choose Next.

    6. On the Add permissions tab, choose Next.

    7. For Role name, enter a unique name for your role such as "eksClusterRole".

    8. For Description, enter descriptive text such as

      "My First EKS Cluster Role".

    9. Choose Create role.

  1. Cluster Creation Process

    1. Choose default configurations under the "Specify Networking" section, then click Next.

    2. Don't enable any logging to save costs, then click Next.

    3. Select default add-ons, then click Next.

    4. Review and create the cluster, then click Create.

Create a Node IAM Role Follow these steps to create an Amazon EKS node role in the IAM console:

    1. Open the IAM console at IAM Console.

      1. In the left navigation pane, choose Roles.

      2. On the Roles page, choose Create role.

      3. On the Select trusted entity page, do the following:

        1. In the Trusted entity type section, choose AWS service.

        2. Under Use case, choose EC2.

        3. Choose Next.

      4. On the Add permissions page, do the following:

        1. In the Filter policies box, enter AmazonEKSWorkerNodePolicy.

        2. Select the checkbox to the left of AmazonEKSWorkerNodePolicy in the search results.

        3. Choose Clear filters.

        4. In the Filter policies box, enter AmazonEC2ContainerRegistryReadOnly.

        5. Select the checkbox to the left of AmazonEC2ContainerRegistryReadOnly in the search results.

        6. Either the AmazonEKS_CNI_Policy managed policy or an IPv6 policy that you create must also be attached to either this role or to a different role that's mapped to the aws-node Kubernetes service account. It is recommended to assign the policy to the role associated with the Kubernetes service account instead of assigning it to this role. For more information, see Configuring the Amazon VPC CNI plugin for Kubernetes to use IAM roles for service accounts.

        7. Attach the following three policies:

          • AmazonEKSWorkerNodePolicy

          • AmazonEC2ContainerRegistryReadOnly

          • AmazonEKS_CNI_Policy

  1. Choose Next.

    1. On the Name, review, and create page, do the following:
  2. For Role name, enter a unique name for your role such as "AmazonEKSNodeRole".

  3. For Description, replace the current text with descriptive text such as "Amazon EKS - Node role".

  4. Under Add tags (Optional), add metadata to the role by attaching tags as key-value pairs. For more information about using tags in IAM, see Tagging IAM Entities.

  5. Choose Create role.

    1. Add Node Group to Your Cluster
  6. Mention the Node Configuration.

  1. Connect to the Cluster If the AWS CLI is not installed, use the commands below to install it:

Download and run the AWS CLI MSI installer for Windows (64-bit):

https://awscli.amazonaws.com/AWSCLIV2.msi
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
sudo ./aws/install

Configure the AWS CLI:

aws configure
Give the access key and secret key to configure
aws sts get-caller-identity

Install kubectl on a local Windows machine: Install kubectl on Windows

Connect to the EKS cluster:

aws eks --region <region> describe-cluster --name <clustername> --query cluster.status
aws eks --region ap-south-1 describe-cluster --name eks-first-cluster --query cluster.status

aws eks --region <region> update-kubeconfig --name <clustername>
aws eks --region ap-south-1 update-kubeconfig --name eks-first-cluster

kubectl get nodes