Application Deployment on AWS EKS

AWS EKS allows you to create your own Kubernetes clusters in the AWS cloud very quickly and easily.
First, let’s look at how to create the AWS EKS Kubernetes cluster.

AWS Prerequisites and Knowledge:

  • IAM Users by programmatically and Console access.
  • IAM Roles for your services.
  • AWS Command-line interfaces usage.
  • VPC, Availability zone, subnets & Security Groups.

    Docker & Kubernetes Prerequisites and knowledge:
  • Basic docker usage.
  • Docker Desktop & kubectl installed on your machine.

    Create EKS Kubernetes Cluster Using GUI

Step 1: Create a Master Node, follow the below steps to create one.

a) Log in to the AWS portal, find the Kubernetes Service by searching for EKS and click on Create Kubernetes Cluster and then specify the name for the Cluster.


b) Next is to create the role, click on “Create role” -> AWS Service -> EKS (from AWS Services) -> Select EKS Cluster -> Next Permissions.


c) Create a New Role or Choose an existing one.


 

d) Leave the selected policies as-it-is and click on Review Page.

e) Enter a name for the role (e.g. eksClusterRole) and hit the Create role button at the bottom of the page to create the IAM role. The IAM role is created.


In this step, we need to assign all the network configurations of our EC2 instances as we create them. It will automatically take all the available subnets.

The last field is about the security group. We can choose the default security group (We need to do a change in the future but not right now).

As before, we can leave all the default settings for the rest of the fields. Click on “Next” and finish the cluster creation. So, that’s all we need to do to create the cluster. It should take a long time while AWS sets up the cluster and we should see something like this:




f) Now Master node will be created in approximately 15-20 minutes.

Step 2: Next step is to Install & configure AWS CLI on the EC2 instance. Follow the below links and steps for the same;

    • To get the Latest EKS UserGuide visit Getting started AWS Console, Click Here
    • Know more about the CLI UserGuide from CLI Configure Quickstart,Click Here
    a) Click the account name and select Security Credentials. scroll down and Click on Create Access key.




    Step 3: Next is to install & configure the kubectl, by checking your Cluster Name & Region Name where the EKS Master node is running from the console. Check the status of Cluster and Configure kubectl with EKS API Server and validate kubectl configuration to master node.

    To know more go through the blog Install and Configure kubectl, Know More


    Step 4: The final step is to create the Worker Node.

    a) On the cluster page, select the Compute tab, and then choose Add Node Group.

    b) On the Configure node group page, fill out the parameters accordingly, and then choose Next.

    • Name – Enter a unique name for your managed node group.
    • Node IAM role name– Choose the node instance role to use with your node group. For more information, see the Amazon EKS worker node IAM role, Click Here

      For this service we need to choose an EC2 Service Role and assign the followings permissions:
      • AmazonEKSWorkerNodePolicy
      • AmazonEC2ContainerRegistryReadOnly
      • AmazonEKS_CNI_Policy

      Each permission allows to EC2 instances create the node to communicate with AWS, pull images from ECR and Assign the right IP inside the VPC and subnet configuration.




    After following all the above steps, leave the other settings to default and proceed further.

    Step 6: Next is to configure the Compute & scaling of Worker Nodes.

    a) In this step we are providing the compute configurations. Follow the images below and complete the process:

      


    b) Keep rest as default. On the Review and create page, review your managed node group configuration, and choose to Create. Worker Node Group is under creation so wait for 2-3 minutes for workers nodes to be Active and running.


    Step 7: The final step is to verify the Worker node status from Kubectl. For the same perform the given command:

    • To Check the status of the cluster: 

      aws eks --region us-east-1 describe-cluster --name MyEKSK8sCluster --query cluster.status


      aws eks --region us-east-1 update-kubeconfig --name MyEKSK8sCluster


    AWS Provides us with all the necessary commands to sync our image with the newly created ECR repository, but before this, you must authenticate in your AWS CLI. Use the following command with the credentials of the user we just created.

    You’ll be able to see 4 commands that you can run in your terminal.
    1. The first command gets the login password for ECR and sets it directly to Docker to connect AWS with your Docker Desktop App.
    2. The second one is simply to build the image using the name of your repository.
    3. This one links the tag of the image you just created to the AWS ECR repository.


    And finally, we send the image to AWS ECR. This could take a long time while it sends all the images (~300MB) to the cloud.



    Congratulations! Your container has been deployed on your EKS Kubernetes Cluster.

    Thank You So Much!!


    Comments