AWS EKS
What is AWS EKS?
Amazon Elastic Kubernetes Service (EKS) is a managed Kubernetes service that makes it easy for us to run Kubernetes on AWS without needing to install, operate, and maintain our own Kubernetes control plane. Amazon EKS is certified Kubernetes conformant, so existing applications running on upstream Kubernetes are compatible with Amazon EKS.
Amazon EKS automatically manages the availability and scalability of the Kubernetes control plane nodes that are responsible for starting and stopping containers, scheduling containers on virtual machines, storing cluster data, and other tasks. Amazon EKS automatically detects and replaces unhealthy control plane nodes for each cluster.
We can choose to run our EKS clusters using AWS Fargate, which is serverless compute for containers. Fargate removes the need to provision and manage servers, lets us specify and pay for resources per application, and improves security through application isolation by design.
With Amazon EKS, we can take advantage of all the performance, scale, reliability, and availability of the AWS platform, as well as integrations with AWS networking and security services, such as Application Load Balancers for load distribution, Identity Access Manager (IAM) for role based access control, and Virtual Private Cloud (VPC) for pod networking.
Benefits of EKS
A. High Availability
B. Serverless option
C. Secure
D. Built with the Community
How EKS works
Use Cases of EKS
A. Hybrid Development
B. Machine Learning
C. Batch Processing
D. Web Applications
Ways of using EKS
A. WEB UI
B. Command line(aws eks , eksctl commands and yml file)
C. Terraform Code
D. Helm Charts
For using EKS service a user with powers of managing the services is always a good practice. For this create an IAM user and configure cli for that user using "aws configure" command and for cheking the correct configure use "aws--version" command. Using eksctl command reduces the repetitive usage of aws eks command. Configuring eksctl command is so easy just download it from and set the path. For reference below is the link for eksctl setup-
Also install Kubectl command. for reference guide below is the link-
Now when the cli is configured, we are ready to launch eks cluster. for this we are free to use any of the above way of using EKS but using yml file or terraform code is always considered as a good practice. below is the yml file for creating eks cluster-
using command "eksctl create cluster -f <ymlfilename>" we can launch the eks cluster and check either using "eksctl get clusters" command or from webui.
When the cluster is launched we can use it. we can create a separate namespace for nodes and namespace with cluster. For this we can use following commands-
kubectl create namespace <namespace-name>
kubectl config set-context --current --namespace=<namespace-name>
we can check description of nodes by using command "kubectl describe nodes <hostname>
Create Storage Class and Persistent Volume with following yml code-
To run these codes we use "kubectl create" command
Verify the creation of storage class using "kubectl get sc" and "kubectl get pvc".
Finally we are ready to launch deployment using yml code-
we can check that deployment is created or not using command "kubectl get deploy"
Now expose the deployment so that people from outside world can use it.
"kubectl expose deployment <deployment-name> --type=LoadBalancer --port=<portnumber>
verify using "kubectl get svc"
If we want that our application to run as serverless and managed in their own we can use fargate cluster. Fargate allocates the right amount of compute, eliminating the need to choose instances and scale cluster capacity. This enables our application to have workload isolation and improved security by design. This is why customers such as Vanguard, Accenture, Foursquare, and Ancestry have chosen to run their mission critical applications on Fargate.
verify the persistency of the volume by changing the data inside the pv and deleting the pod. We can see that the data remains same. This is the advantage of using pv. Reference yml codes on below link
That's all about working on EKS with yml code. Same we can do with terraform code. Using terraform code we can create a separate vpc with subnets, routingb table, internet gateways, and security rules for EKS cluster. Reference for terraform code-
In the above repository the terraform code is written for following -
- Create a vpc, subnet, internet gateway, routing table and association of the routing table created.
- Create an iam role for eks cluster, policy for iam role & attachments of policy, security group,and eks cluster.
- Creating nodegroup for the cluster.
Other than terraform code there is another way that is Helm charts. This provides very easy way of deploying applications on eks cluster. Helm is a tool that streamlines installing and managing Kubernetes applications. ... A single chart might be used to deploy something simple, like a memcached pod, or something complex, like a full web app stack with HTTP servers, databases, caches, and so on. Reference for helm documentation-
Example:
Below is the reference for yml code for deploying wordpress application on EKS cluster with EBS provisioner.
REFERENCE GITHUB URL:- https://github.com/bhawyabhupesh/AWS_EKS
For any suggestion dm me.
Thanking you for reading my article.
Great !