How to deploy a Kubernetes App Instantly with AWS EKS
Tags: aws, kubernetes, docker, devjournal
Published: 2022-09-20 19:16:05

Amazon Web Services(AWS) is a reputed cloud service provider, while Kubernetes is gradually becoming a standard app container management method. While many developers happily use Kubernetes, its time-consuming cluster management process often becomes a roadblock in scaling when operating at scale.

To solve this issue, developers can use orchestration to successfully adopt containers in the cloud. AWS offers two fully managed container services– ECS and EKS. Both provide scalability and reliability of AWS, integrate with other AWS services, and support various compute options. However, [Amazon ECS vs. EKS](https://www.simform.com/blog/amazon-ecs-vs-eks/) is a heated debate.

You can seamlessly transform into a full-fledged app from a single Docker container with ECS. But when it comes to the scalability and availability of the control plane nodes, EKS emerges as a frontrunner. 

These nodes allow you to schedule containers and store cluster data. This article will explore how we can deploy Kubernetes applications using AWS EKS.

##Amazon EKS for Kubernetes App Development

Amazon EKS enables users to run Kubernetes on AWS without the need to maintain their Kubernetes control plane. It is a managed service that handles provisioning, upgrades, and patching tasks. 

Amazon EKS runs over a secure infrastructure that contains an encrypted communication channel between worker nodes & Kubernetes endpoint. As a result, applications managed by Amazon EKS are fully compatible with applications driven by any standard Kubernetes environment.

Let's look at how to use Amazon EKS to build the Kubernetes app -

###Build an AWS EKS role

- First, create an EKS role that Kubernetes can assume to provide necessary resources.
- Then login to the AWS Management Console, click on the role, and produce the role.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/luhfunf6ulx4ama6b0sh.jpg)

- Next, select EKS under AWS Services and click on Next: Permission
- Then, it will select two policies for the Role -AmazonEKSClusterPolicy and AmazonEKSServicePolicy
- Click Next: Review to provide Role Name and Click Create Role

###Create VPC for EKS Cluster

The next step is to [create an EKS cluster](https://docs.aws.amazon.com/eks/latest/userguide/getting-started-eksctl.html). Next, you need to specify the VPC subnets for the cluster. You'd have two subnet availability zones - Create public and private subnets or create only public subnets.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ecj2g2ii5njkuyzfxhq3.jpg)

- Navigate to the Amazon EKS console and click on "Create Cluster"
- Enter cluster name, role ARN, VPC, subnets, and security groups
- In the end, click "Create" for Amazon EKS cluster creation

###Install and configure kubectl for the EKS cluster

Kubernetes uses Kubectl - a command-line utility for communicating with the Kubernetes cluster. Also, Amazon EKS clusters require the AWS IAM Authenticator for Kubernetes to allow IAM authentication for your cluster. 

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ytrgw7yp8bg93nah8s46.jpg)

You must install these binaries and follow the instructions for downloading Amazon EKS documentation. Next, you must use the AWS CLI update-kubeconfig command to create or update your kubeconfig for your cluster. Then, you should test your configuration.

###Launch Amazon EKS worker nodes

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/f7cmbuoz55xzh08b8oh7.jpg)

After you install kubectl, you need to wait for your status to display ACTIVE. Once the control plane of your cluster gets active, the next step is to add nodes to it by following these steps -

- Click on the “Create stack” option after Navigating to the CloudFormation console
- Choose the option to “Specify an Amazon S3 template URL” and enter the URL on the “Select Template” page
- On the “Specify Details” page, enter the necessary details
- Click “Create” after reviewing them
- After completing stack creation select the stack name from the list of available stacks 
- Select the “Outputs” section

After you complete the above steps, you need to follow these steps to enable worker nodes to join the Kubernetes cluster -

- Create a file named aws-auth-cm.yaml on your system 
- Replace the AWS-ARN with the node instance role
- Apply the configuration and watch the status of your nodes 
- Wait for them to reach the Ready state

##Conclusion

Here we have shown the steps to create and deploy Kubernetes apps using AWS EKS. Apart from this, there are many other concepts inside Kubernetes and on EKS that you can check out. So, ensure you learn everything thoroughly until you can confidently deploy and manage Kubernetes applications.