In this post i am going to talk about EKS. And more specific:
- What Is AWS EKS?
- How To Setup EKS?
- How to create a K8S cluster in AWS using Cloudformation?
Amazon Elastic Kubernetes Service (EKS) is a managed Kubernetes service provided by AWS that makes it easy to deploy, scale, and manage containerized applications using Kubernetes. With EKS, you can run Kubernetes on AWS without the need to stand up and maintain your own Kubernetes control plane.
EKS is built on top of the highly available and scalable infrastructure of AWS, making it a great option for running production-grade Kubernetes clusters. It also integrates with other AWS services, such as Elastic Load Balancing, Amazon RDS, and Amazon S3, allowing you to easily manage your entire application stack on AWS.
One of the key features of EKS is its ability to automatically manage the availability and scalability of the Kubernetes control plane. The control plane is the set of components that manage the state of your Kubernetes cluster, such as the API server, etcd, and the controller manager. EKS automatically scales and updates the control plane, ensuring that it is always available and running the latest version of Kubernetes.
EKS offers a 99.95% uptime SLA. At the same time, the EKS console provides observability of your Kubernetes clusters so you can identify any issue quickly and get it resolved.
In addition to managing the control plane, EKS also makes it easy to manage worker nodes. Worker nodes are the EC2 instances that run your containerized applications. With EKS, you can use EC2 Auto Scaling groups to automatically scale the number of worker nodes based on the demands of your applications. You can also use EC2 Spot instances to save cost on your worker nodes.
It also supports multiple availability zones, allowing you to run your cluster across multiple regions for high availability. This can be set up using EKS multi-AZ feature, by creating the cluster in multiple availability zones and nodes will be spread across all availability zones.
To deploy your applications on EKS, you can use Kubernetes manifests to define your application’s resources, such as pods and services. These manifests can be deployed using the kubectl command-line tool, or through a CI/CD pipeline using tools such as Helm, kubectl, or eksctl. Or even better you can use ArgoCD or FluxCD (Gitops).
Here is an example CloudFormation template that deploys an Amazon Elastic Kubernetes Service (EKS) cluster along with a worker node group:
---
AWSTemplateFormatVersion: '2010-09-09'
Resources:
MyCluster:
Type: AWS::EKS::Cluster
Properties:
Name: MyCluster
ResourcesVpcConfig:
SecurityGroupIds:
- !Ref SecurityGroup
SubnetIds:
- !Ref Subnet1
- !Ref Subnet2
- !Ref Subnet3
SecurityGroup:
Type: AWS::EC2::SecurityGroup
Properties:
GroupName: MyClusterSecurityGroup
SecurityGroupIngress:
- IpProtocol: tcp
FromPort: 22
ToPort: 22
CidrIp: 0.0.0.0/0
Subnet1:
Type: AWS::EC2::Subnet
Properties:
CidrBlock: 10.0.1.0/24
VpcId: !Ref MyVpc
AvailabilityZone: eu-west-2a
Subnet2:
Type: AWS::EC2::Subnet
Properties:
CidrBlock: 10.0.2.0/24
VpcId: !Ref MyVpc
AvailabilityZone: eu-west-2b
Subnet3:
Type: AWS::EC2::Subnet
Properties:
CidrBlock: 10.0.3.0/24
VpcId: !Ref MyVpc
AvailabilityZone: eu-west-2c
WorkerNodeGroup:
Type: AWS::EKS::Nodegroup
Properties:
ClusterName: !Ref MyCluster
NodegroupName: "myworker-nodes"
ScalingConfig:
DesiredSize: 3
MaxSize: 6
MinSize: 3
Subnets:
- !Ref Subnet1
- !Ref Subnet2
- !Ref Subnet3
InstanceTypes:
- t3.medium
DiskSize: 30
This code, creates worker node group named “myworker-nodes” and attaches it to the EKS cluster. The ScalingConfig
property of worker node group is set to a desired size of 3 , with the ability to scale to a max size of 6 and a min size of 3. It is using 3 subnets, t3.medium instance types, and 30 GB root disk size. (Note: This is just for demo purposes and can not be used for your Production environment)