Unveiling the Wonders of AWS EKS! πŸŒπŸ’‘

Unveiling the Wonders of AWS EKS! πŸŒπŸ’‘

Β·

6 min read

What is Kubernetes?

  • Kubernetes is an open-source container orchestration platform originally developed by Google and now maintained by the Cloud Native Computing Foundation (CNCF). It automates the deployment, scaling, and management of containerized applications. Kubernetes abstracts the underlying infrastructure, allowing users to deploy and manage applications seamlessly across clusters of machines. It provides features like service discovery, load balancing, self-healing, rolling updates, and storage orchestration, enabling efficient management of containerized workloads in production environments.

Architecture of Kubernetes:

  • Kubernetes is an open source container deployment and management platform. It offers container orchestration, a container runtime, container-centric infrastructure orchestration, load balancing, self-healing mechanisms, and service discovery. Kubernetes architecture, also sometimes called Kubernetes application deployment architecture or Kubernetes client server architecture, is used to compose, scale, deploy, and manage application containers across host clusters.

  • The architecture of Kubernetes (often abbreviated as K8s) revolves around a master-slave model:

    • Master Node: This is the control plane of the Kubernetes cluster. It consists of several components:

      • API Server: Acts as the front-end for the Kubernetes control plane. It validates and configures data for the API objects, such as pods, services, and deployments.

      • Scheduler: Watches for newly created pods with no assigned node, and selects a node for them to run on.

      • Controller Manager: Runs controller processes, which regulate the state of the cluster, such as deployments, replica sets, and endpoints.

      • etcd: A distributed key-value store that stores the cluster's configuration data, ensuring consistency and resilience.

    • Worker Node: These are the machines (physical or virtual) where containers are deployed. Each worker node contains the following components:

      • Kubelet: An agent that runs on each node in the cluster, ensuring that containers are running in a pod.

      • Container Runtime: Software responsible for running containers, such as Docker or containerd.

      • Kube-proxy: Maintains network rules on nodes. It enables communication across the cluster and performs simple load balancing.

      • Pod: A single instance of a running process in a cluster. It can run one or more containers and share the same resources.

This architecture allows Kubernetes to manage the deployment, scaling, and operation of application containers across clusters of hosts. The master node handles the orchestration and coordination, while the worker nodes execute the actual workloads.

What is Elastic Kubernetes Service (EKS)?

  • Amazon Elastic Kubernetes Service (Amazon EKS) is a managed Kubernetes service provided by Amazon Web Services (AWS). It simplifies the process of deploying, managing, and scaling Kubernetes clusters in the AWS cloud. With EKS, users can run containerized applications using Kubernetes without needing to install or manage the Kubernetes control plane infrastructure. It offers features like automatic scaling, high availability, and integration with other AWS services, making it an ideal platform for deploying and managing containerized workloads at scale.

Benefits of Amazon EKS:

  • Scalability: EKS allows you to scale your applications effortlessly as your requirements change.

  • High Availability: It offers a highly available and reliable environment for your applications.

  • Easy Management: AWS manages the control plane, so you can focus on your applications

Architecture of Elastic Kubernetes Service (EKS):

The architecture of AWS Elastic Kubernetes Service (EKS) involves several key components:

  1. Kubernetes Control Plane: This includes master nodes managed by AWS. It consists of the API server, scheduler, controller manager, and etcd (a distributed key-value store for Kubernetes configuration and state).

  2. Worker Nodes: These are EC2 instances that run the Kubernetes kubelet, which interacts with the control plane components. Each worker node also runs a container runtime like Docker or containerd to manage containers.

  3. VPC (Virtual Private Cloud): EKS clusters are deployed within a VPC, providing network isolation and security. Subnets within the VPC are used for deploying different components of the EKS cluster.

  4. Security Groups and IAM Roles: Security groups control inbound and outbound traffic to the EKS cluster. IAM roles define permissions for accessing AWS resources, including EKS APIs and cluster resources.

  5. Auto Scaling Groups: Worker nodes are managed by Auto Scaling Groups, allowing for dynamic scaling based on resource utilization.

  6. Load Balancers: AWS provides integration with Elastic Load Balancers (ELBs) or Application Load Balancers (ALBs) for distributing incoming traffic to the Kubernetes services running on the cluster.

  7. Networking: EKS uses Amazon VPC CNI (Container Networking Interface) to manage networking between pods. This allows each pod to have its own IP address within the VPC.

  8. EKS Control Plane Endpoints: These are public and private endpoints for accessing the Kubernetes API server, which allows cluster management and interaction with the Kubernetes control plane.

Overall, AWS EKS provides a managed Kubernetes service, handling the deployment and scaling of the control plane while allowing users to manage and scale worker nodes according to their requirements.

Setting up Amazon EKS:

  1. Create an AWS Account:

    If you haven't already, sign up ξ€’or an AWS ξ€’ree tier account.

  2. Install AWS CLI:

    Install and configure the AWS Command Line Interξ€’ace (CLI) on your local.

Commands:

curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o
"awscliv2.zip"
sudo apt install unzip
unzip awscliv2.zip
sudo ./aws/install -i /usr/local/aws-cli -b /usr/local/bin --update
  1. Create an IAM Role for EKS:

    Create an IAM role with the necessary permissions ξ€’or EKS.

  2. Steps:

    1. Create an IAM User:

      Go to the AWS IAM console.

      Create a new IAM user named "eks-admin."

      Attach the "AdministratorAccess" policy to this user.

    2. Create Security Credentials:

      After creating the user, generate an Access Key and Secret Access Key for this user.

  3. Launch AWS instance and get access to the instance

  4. Configure AWS CLI:

  5. Configure the AWS CLI with the Access Key and Secret Access Key from step 2:

Install eksctl:

  1. Download and extract the latest release of eksctl with the following command.
curl --silent --location "https://github.com/weaveworks/eksctl/releases/latest/download/eksctl_$(uname -s)_amd64.tar.gz" | tar xz -C /tmp
  1. Move the extracted binary to /usr/local/bin.
sudo mv /tmp/eksctl /usr/local/bin
  1. Test that your installation was successful with the following command. You must have eksctl 0.34.0 version or later.
eksctl version

Install kubectl:

  1. Download the latest release with the command:
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
  1. Validate the binary (optional):
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl.sha256"
  1. Validate the kubectl binary against the checksum file:
echo "$(cat kubectl.sha256)  kubectl" | sha256sum --check
  1. If valid, the output is:

  1. Install kubectl:
sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl
  1. Test to ensure the version you installed is up-to-date:
kubectl version --client
  1. If valid, the output is:

EKS Cluster Setup:

  • Use eksctl to create the EKS cluster.
eksctl create cluster --name eksdemo --region us-west-2 --node-type t2.micro --nodes-min 2 --nodes-max 3
  • Update your kubeconfig to connect to the newly created EKS cluster:
  • Verify Nodes:
kubectl get nodes

Basic to Advanced EKS Commands:

  1. Get Cluster Information:
 aws eks describe-cluster --name <cluster name> --region <region name>
  1. List Worker Nodes:
 kubectl get nodes
  1. Deploy an application:
 kubectl apply -f <yaml file>
  1. View Pods in a Namespace:
 kubectl get pods -n <namespace>
  1. Check Cluster Events:
kubectl get events
  1. Create a Persistent Volume:
kubectl apply -f <pv-definition.yaml>
  1. Apply a Rolling Update:
kubectl set image deployment/<deployment-name> <container-name>=<new-
image>
  1. Enable Autoscaling:
kubectl autoscale deployment <deployment-name> --min=3 --max=5

Unlocking the doors to AWS EKS! Your newfound knowledge is a testament to your commitment to cloud-native orchestration. As you continue your journey, may your AWS EKS expeditions bring forth innovative and resilient containerized solutions. πŸš€πŸŒ #AWSEKS #Kubernetes #CloudOrchestration #DevOpsJourney πŸ’‘πŸŒŸ

Keep Learning................

Β