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
b) Next is to create the role, click on “Create role” -> AWS Service -> EKS (from AWS Services) -> Select EKS Cluster -> Next Permissions.
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.
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
To know more go through the blog Install and Configure kubectl, Know More
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:AmazonEKSWorkerNodePolicyAmazonEC2ContainerRegistryReadOnlyAmazonEKS_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.
- 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
Uploading our service image to ECR
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.
- The first command gets the login password for ECR and sets it directly to Docker to connect AWS with your Docker Desktop App.
- The second one is simply to build the image using the name of your repository.
- This one links the tag of the image you just created to the AWS ECR repository.
Creating deployment files
Now we’re going to prepare the necessary files to give the instructions to EKS about what image it should pull and also set how many pods we need.
Check out the following file: GitHub Link

- The First object is a service, the cluster-IP service type is in charge of making communicable the pod or your container within the node, this means other services or apps internally created can access your service.
- Lastly, we’re declaring a “Deployment” Object type. This tells K8S how many pods should be up. It also tells Docker which image to pull from the repository. See that in line 46 we are assigning the image we uploaded before to AWS. What you should do is copy the URL of the image in ECR and paste it there.
Now is the time to Deploy our service to EKS!
Now, just we’re one command closer to seeing our service in the Cloud powered by EKS and EC2 instances. To achieve this, we need to run the following command:
Kubernetes namespace for the sample app:-
kubectl create namespace my-namespace
Create a Kubernetes service and deployment:-
kubectl apply -f Services.yaml
This command will sync the statements you write in the deployment file with EKS and all the pods will start to be created and initialized.
Now, how can we access our service? We just need to check the URL provided by AWS You can see the info running:
kubectl -n my-namespace get service my-service
It will respond to you with all the services including the URL in the External-IP Column.
Now, when we visit this URL is replicated to all the Domain name services in the world. After some minutes you can check your service is up and running like this:
Congratulations! Your container has been deployed on your EKS Kubernetes Cluster.


















Comments
Post a Comment