What is AWS?
It is a platform that offers cloud computing solutions
The platform is developed with a combination of infrastructure as a service (IaaS),
platform as a service (PaaS) and packaged software as a service (SaaS) offering
Services of AWS to be used
AWS RDS – This database AWS service is easy to set up, operate, and scale a relational
database in the cloud
AWS EKS – The tool allows you to use Kubernetes on Amazon cloud environment
without installation
AWS ALB – Load Balancer
AWS EC2 Instance – EC2 is a virtual machine in the cloud on which you have OS level
control. You can run this cloud server whenever you want.
How to install different CLI’s using chocolatey
choco install awscli
choco install eksctl
choco install kubernetes-cli
While creating EKS clusters we need these 3 command line tools to interact with AWS, n
k8 clusters created using eksctl
Prerequisite
Before starting with EKS cluster creation, you must install and configure the following
tools and resources that you need to create and manage an Amazon EKS cluster
o Kubectl
o Eksctl
o Required IAM permissions with AWS CLI
Why do we need AWS CLI
The AWS CLI is a powerful tool that allows users to interact with various AWS resources
and services through a command-line interface.
Generate Access key in AWS IAM for local to connect through CMD
Sign in to the AWS Management Console using your root user credentials
Open the AWS Management Console and navigate to the AWS Identity and Access
Management (IAM) service
Inside IAM click manage Access Keys
Click create access key and download .csv file
Connect to AWS through CMD using CLI
Open cmd and run command “aws configure”
Enter AWS Access Key ID and AWS secret access key
What is EKSCTL
eksctl is simple command line tool for creating and managing Kubernetes clusters on
Amazon EKS
https://eksctl.io/
We can create a basic cluster in minutes with just one command
o eksctl create cluster
A cluster will be created with default parameters:
o exciting auto-generated name, e.g., fabulous-mushroom-1527688624
o two m5.large worker nodes
o use the official AWS EKS AMI
o us-west-2 region
o a dedicated VPC (check your quotas)
But we might need some customization so either we can
o Create a yaml
o Give params in command line
eksctl provides the fastest and easiest way to create a new cluster with nodes for
Amazon EKS
How to deploy EKS cluster
Deploy eks cluster using below command
eksctl create cluster --name <cluster name> --region <region name> --nodegroup-name
<node name> --node-type t3.medium --nodes 1
--name cluster-name: Specifies the name of the EKS cluster you want to create. Replace
“cluster-name” with your desired name for the cluster
--region region-name: Specifies the AWS region where you want to create the EKS
cluster. Replace “region-name” with the desired AWS region, such as “us-west-2” for US
West (Oregon)
--nodegroup-name node-name: Specifies the name of the node group within the EKS
cluster. Replace “node-name” with your desired name for the node group.
--node-type t3.medium: Specifies the EC2 instance type for the worker nodes in the
node group. In this case, it is set to “t3.medium”. You can choose different instance type
according to your requirements.
--nodes 1: Specifies the desired number of worker nodes in the node group. In this case,
it is set to “1”. You can adjust this number as needed.
By running this command, eksctl will create an EKS cluster with the specified name, in
the specified region, with a node group using t3.medium instances and a desired
capacity of 1 node.
When the eksctl create cluster command completes successfully, it generates the
kubeconfig file with the appropriate configurations, including the cluster’s endpoint,
authentication details, and other necessary information. This kubeconfig file is then
stored on your local machine in the default location.
What is the Kubeconfig file
The kubeconfig file necessary for authenticating and accessing the EKS cluster.
By default, the kubeconfig file is updated with the necessary information to connect to
the newly created EKS cluster, allowing you to use tools like kubectl to interact with the
cluster from your local machine.
Tasks done by this simple command
Cluster Configuration.
Node Group Creation: eksctl provisions the specified node group(s) within the EKS
cluster. This involves launching EC2 instances or Fargate pods as worker nodes that
join the cluster. The command sets up the necessary configuration, such as instance
types, instance profiles, and scaling options.
kubeconfig Update: Once the cluster, control plane, and node groups are created, eksctl
updates the kubeconfig file on your local machine. The kubeconfig file is configured with
the necessary authentication details, cluster endpoint, and other configurations
required to connect to the EKS cluster using tools like kubectl.
IAM Role Creation: eksctl creates an IAM role for the EKS cluster’s control plane. This
role grants necessary permissions to manage the cluster and its resources.
VPC Creation: If a VPC is not already available, eksctl creates a new Amazon Virtual
Private Cloud (VPC) with the required subnets, routing, and security groups. This VPC
will be used for the EKS cluster’s networking.
Control Plane Provisioning: Control plane is a master node. The command provisions
the EKS control plane, which manages the cluster’s resources, networking, and scaling.
eksctl interacts with the Amazon EKS service to create and configure the control plane
components.
Cluster Verification: After the cluster creation process, eksctl performs verification
checks to ensure the cluster is successfully provisioned and accessible. It confirms that
the nodes are running and communicating with the control plane.
What is EKS
AWS EKS (Amazon Elastic Kubernetes Service) is a managed container orchestration
service provided by AWS.
It simplifies the deployment, management, and scaling of containerized applications
using Kubernetes.
AWS EKS is suitable for organizations and developers looking to leverage Kubernetes for
container orchestration without the complexity of managing the underlying
infrastructure.
It offers a reliable, scalable, and secure environment for deploying and managing
containerized applications in the AWS cloud.
What is Amazon EKS control plane architecture
The control plane in a Kubernetes cluster is like the brain or central command centre of
cluster. It is responsible for managing and controlling all the nodes (machines) and
applications running within the cluster.
It runs on managed master nodes that are fully managed and maintained by AWS.
The control plane consists of several components that work together:
o API Server: This is like the interface or entry point for users and other
components to interact with the cluster. It receives requests and instructions and
communicates with other components to carry out the necessary actions.
o etcd: This is like the memory or database of the cluster. It stores the current state
and configuration information of the cluster, including things like which nodes
are part of the cluster, which applications are running, and other important
details.
o Controllers: These are like the managers or supervisors of the cluster. They
constantly monitor the cluster’s state, compare it with the desired state (as
defined by users or configurations), and take actions to bring the cluster to the
desired state. For example, if a node fails, the Node Controller will detect it and
take action to replace or repair the node.
o Scheduler: This component is responsible for deciding where and how to run
new applications or workloads within the cluster. It considers factors like
available resources, constraints, and requirements to make smart decisions
about workload placements.
o Networking: The control plane also handles networking aspects, ensuring that
nodes can communicate with each other and that applications running on
different nodes can reach each other.
How does Amazon EKS work?
Create an Amazon EKS cluster in the AWS Management Console or with the AWS CLI
or one of the AWS SDKs.
Launch managed or self-managed Amazon EC2 nodes or deploy your workloads to
AWS Fargate.
When your cluster is ready, you can configure your favourite Kubernetes tools, such as
kubectl, to communicate with your cluster.
Deploy and manage workloads on your Amazon EKS cluster the same way that you
would with any other Kubernetes environment (like Rancher). You can also view
information about the workloads using the AWS Management console.
Why AWS RDS
We can deploy our DB also as a Deployment/Pod
But what if Pod crashes?
Your data is lost and that’s the task of DB – to manage data
So now you have following options
o Deployments with Persistent volumes – but not recommended because it’s for
stateless apps
o Stateful set with PV – difficult to manage and create
o Best way is to segregate it completely outside the cluster
o So, use AWS RDS
What is AWS RDS
AWS RDS (Relational Database Service) is a fully managed database service provided by
AWS. It enables you to set up, operate, and scale relational databases in the cloud easily.
By leveraging AWS RDS, you can quickly provision database instances, scale
resources up or down as needed, and easily manage your databases using the AWS
Management Console, CLI, or APIs. This allows you to focus on building applications
without worrying about the underlying infrastructure and maintenance of your
databases.
With AWS RDS, we have the option to choose from various popular relational database
engines including
o MySQL
o PostgreSQL
o MariaDB
o Oracle
o Microsoft SQL Server