Table of contents
No headings in the article.
Follow the steps below to create an EKS Kubernetes Cluster on AWS Cloud:
- Create a New Cluster Go to the following link to create a new cluster: AWS EKS Console
Create Cluster Role Follow these steps to create a cluster role:
Open the IAM console at IAM Console.
Choose Roles, then Create role.
Under Trusted entity type, select AWS service.
From the Use cases for other AWS services dropdown list, choose "EKS".
Choose "EKS - Cluster" for your use case and then choose Next.
On the Add permissions tab, choose Next.
For Role name, enter a unique name for your role such as "eksClusterRole".
For Description, enter descriptive text such as
"My First EKS Cluster Role".
Choose Create role.
Cluster Creation Process
Choose default configurations under the "Specify Networking" section, then click Next.
Don't enable any logging to save costs, then click Next.
Select default add-ons, then click Next.
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:
Open the IAM console at IAM Console.
In the left navigation pane, choose Roles.
On the Roles page, choose Create role.
On the Select trusted entity page, do the following:
In the Trusted entity type section, choose AWS service.
Under Use case, choose EC2.
Choose Next.
On the Add permissions page, do the following:
In the Filter policies box, enter
AmazonEKSWorkerNodePolicy
.Select the checkbox to the left of
AmazonEKSWorkerNodePolicy
in the search results.Choose Clear filters.
In the Filter policies box, enter
AmazonEC2ContainerRegistryReadOnly
.Select the checkbox to the left of
AmazonEC2ContainerRegistryReadOnly
in the search results.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.Attach the following three policies:
AmazonEKSWorkerNodePolicy
AmazonEC2ContainerRegistryReadOnly
AmazonEKS_CNI_Policy
Choose Next.
- On the Name, review, and create page, do the following:
For Role name, enter a unique name for your role such as "AmazonEKSNodeRole".
For Description, replace the current text with descriptive text such as "Amazon EKS - Node role".
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.
Choose Create role.
- Add Node Group to Your Cluster
Mention the Node Configuration.
- 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