SlideShare a Scribd company logo
StackSimplify
Kubernetes for Absolute Beginners on AWS Cloud
Kalyan Reddy Daida
StackSimplify
© Kalyan Reddy Daida
Kubernetes
on AWS Cloud
Course Outline
StackSimplify
© Kalyan Reddy Daida
Kubernetes on AWS Cloud
Pod
ReplicaSet
Deployment
Service
YAML & kubectl
Pod
ReplicaSet
Deployment
Service
kubectl
Kubernetes Fundamentals
Imperative Declarative
AWS EKS Cluster
YAML K8S Live
Template writing
StackSimplify
© Kalyan Reddy Daida
Kubernetes for Absolute Beginners on AWS Cloud | Part-1
Kubernetes for Absolute Beginners on AWS Cloud | Part-2
Free Courses – 2 Hours limitation on Udemy
StackSimplify
© Kalyan Reddy Daida
AWS EKS
CLIs
StackSimplify
© Kalyan Reddy Daida
AWS EKS Cluster - CLIs
CLIs
AWS CLI
kubectl
eksctl
We can control multiple AWS services from the command line
and automate them through scripts.
We can control Kubernetes clusters and objects using kubectl
1. eksctl is used for creating & deleting clusters on AWS EKS.
2. We can even create, autoscale and delete node groups.
3. We can even create fargate profiles using eksctl
4. In short, it is VERY VERY POWERFUL tool for managing EKS
clusters on AWS.
StackSimplify
© Kalyan Reddy Daida
AWS EKS
Cluster
StackSimplify
© Kalyan Reddy Daida
AWS EKS – Core Objects
EKS Cluster
EKS Control Plane
Worker Nodes &
Node Groups
Fargate Profiles
(Serverless)
VPC
Contains Kubernetes
Master components
like etcd, kube-
apiserver, kube-
controller.
It’s a managed
service by AWS
Group of EC2
Instances where we
run our Application
workloads
Instead of EC2
Instances, we run
our Application
workloads on
Serverless Fargate
profiles
With AWS VPC we
follow secure
networking
standards which will
allow us to run
production
workloads on EKS.
StackSimplify
© Kalyan Reddy Daida
How does EKS work?
© Amazon
StackSimplify
© Kalyan Reddy Daida
EKS Control
Plane
1. EKS runs a single tenant Kubernetes control plane for each cluster, and control plane infrastructure
is not shared across clusters or AWS accounts.
2. This control plane consists of at least two API server nodes and three etcd nodes that run across
three Availability Zones within a Region
3. EKS automatically detects and replaces unhealthy control plane instances, restarting them across
the Availability Zones within the Region as needed.
Worker Nodes
&
Node Groups
1. Worker machines in Kubernetes are called nodes. These are EC2 Instances
2. EKS worker nodes run in our AWS account and connect to our cluster's control plane via the cluster
API server endpoint.
3. A node group is one or more EC2 instances that are deployed in an EC2 Autoscaling group.
4. All instances in a node group must
1. Be the same instance type
2. Be running the same AMI
3. Use the same EKS worker node IAM role
EKS Cluster – Core Objects Detailed
StackSimplify
© Kalyan Reddy Daida
Fargate Profiles
1. AWS Fargate is a technology that provides on-demand, right-sized compute capacity for containers
2. With Fargate, we no longer have to provision, configure, or scale groups of virtual machines to run
containers.
3. Each pod running on Fargate has its own isolation boundary and does not share the underlying
kernel, CPU resources, memory resources, or elastic network interface with another pod.
4. AWS specially built Fargate controllers that recognizes the pods belonging to fargate and schedules
them on Fargate profiles.
5. We will see more in our Fargate learning section.
VPC
1. EKS uses AWS VPC network policies to restrict traffic between control plane components to within a
single cluster.
2. Control plane components for a EKS cluster cannot view or receive communication from other
clusters or other AWS accounts, except as authorized with Kubernetes RBAC policies.
3. This secure and highly-available configuration makes EKS reliable and recommended for production
workloads.
EKS Cluster – Core Objects Detailed
StackSimplify
© Kalyan Reddy Daida
Kubernetes
Architecture
StackSimplify
© Kalyan Reddy Daida
Kubernetes
Architecture
StackSimplify
© Kalyan Reddy Daida
Kubernetes - Architecture
Kube
Controller
Manager
Cloud
Controller
Manager
kube-apiserver
kube-
scheduler
etcd
Container Runtime (Docker)
Master
Kube-Proxy
Worker Node
Kubelet
Container Runtime (Docker)
Kube-Proxy
Worker Node
Kubelet
Container Runtime (Docker)
StackSimplify
© Kalyan Reddy Daida
Kubernetes Architecture - Master
Kube
Controller
Manager
Cloud
Controller
Manager
kube-apiserver
kube-
scheduler
etcd
Container Runtime (Docker)
Master • kube-apiserver
• It acts as front end for the Kubernetes control plane. It
exposes the Kubernetes API
• Command line tools (like kubectl), Users and even
Master components (scheduler, controller manager,
etcd) and Worker node components like (Kubelet)
everything talk with API Server.
• etcd
• Consistent and highly-available key value store used as
Kubernetes’ backing store for all cluster data.
• It stores all the masters and worker node information.
• kube-scheduler
• Scheduler is responsible for distributing containers
across multiple nodes.
• It watches for newly created Pods with no assigned
node, and selects a node for them to run on.
StackSimplify
© Kalyan Reddy Daida
Kubernetes Architecture - Master
Kube
Controller
Manager
Cloud
Controller
Manager
kube-apiserver
kube-
scheduler
etcd
Container Runtime (Docker)
Master • kube-controller-manager
• Controllers are responsible for noticing and
responding when nodes, containers or endpoints
go down. They make decisions to bring up new
containers in such cases.
• Node Controller: Responsible for noticing and
responding when nodes go down.
• Replication Controller: Responsible for maintaining
the correct number of pods for every replication
controller object in the system.
• Endpoints Controller: Populates the Endpoints
object (that is, joins Services & Pods)
• Service Account & Token Controller: Creates default
accounts and API Access for new namespaces.
StackSimplify
© Kalyan Reddy Daida
Kubernetes Architecture - Master
Kube
Controller
Manager
Cloud
Controller
Manager
kube-apiserver
kube-
scheduler
etcd
Container Runtime (Docker)
Master • cloud-controller-manager
• A Kubernetes control plane component that
embeds cloud-specific control logic.
• It only runs controllers that are specific to your
cloud provider.
• On-Premise Kubernetes clusters will not have
this component.
• Node controller: For checking the cloud
provider to determine if a node has been
deleted in the cloud after it stops responding
• Route controller: For setting up routes in the
underlying cloud infrastructure
• Service controller: For creating, updating and
deleting cloud provider load balancer
StackSimplify
© Kalyan Reddy Daida
• Kubelet
• Kubelet is the agent that runs on every node
in the cluster
• This agent is responsible for making sure that
containers are running in a Pod on a node.
• Kube-Proxy
• It is a network proxy that runs on each node
in your cluster.
• It maintains network rules on nodes
• In short, these network rules allow network
communication to your Pods from network
sessions inside or outside of your cluster.
Kubernetes Architecture – Worker Nodes
Kube-Proxy
Worker Node
Kubelet
Container Runtime (Docker)
• Container Runtime
• Container Runtime is the underlying
software where we run all these
Kubernetes components.
• We are using Docker, but we have
other runtime options like rkt,
container-d etc.
StackSimplify
© Kalyan Reddy Daida
AWS EKS
Cluster
StackSimplify
© Kalyan Reddy Daida
EKS Kubernetes - Architecture
EKS
Controller
Manager
Fargate
Controller
Manager
kube-apiserver
kube-
scheduler
etcd
Container Runtime (Docker)
Master
Kube-Proxy
Worker Node -1
Kubelet
Container Runtime (Docker)
Kube-Proxy
Worker Node - 2
Kubelet
Container Runtime (Docker)
EKS Control Plane EKS Node Group
StackSimplify
© Kalyan Reddy Daida
Kubernetes
Fundamentals
Pod, ReplicaSet, Deployment & Service
StackSimplify
© Kalyan Reddy Daida
Kubernetes - Fundamentals
Pod
ReplicaSet
Deployment
Service
k8s Fundamentals
A POD is a single instance of an Application.
A POD is the smallest object, that you can create in Kubernetes.
A ReplicaSet will maintain a stable set of replica Pods running at
any given time.
In short, it is often used to guarantee the availability of a
specified number of identical Pods
A Deployment runs multiple replicas of your application and
automatically replaces any instances that fail or become unresponsive.
Rollout & rollback changes to applications. Deployments are well-
suited for stateless applications.
A service is an abstraction for pods, providing a stable, so called
virtual IP (VIP) address.
In simple terms, service sits Infront of a POD and acts as a load
balancer.
StackSimplify
© Kalyan Reddy Daida
Kubernetes - Imperative & Declarative
Pod
ReplicaSet
Deployment
Service
YAML & kubectl
Pod
ReplicaSet
Deployment
Service
kubectl
Kubernetes Fundamentals
Imperative Declarative
StackSimplify
© Kalyan Reddy Daida
Kubernetes
POD
StackSimplify
© Kalyan Reddy Daida
Kubernetes - POD
Worker Node
Kubernetes Cluster
Node
N
Nginx Container
Image
POD
N
Worker Node
POD
N
Worker Node
• With Kubernetes our core goal will be to
deploy our applications in the form of
containers on worker nodes in a k8s
cluster.
• Kubernetes does not deploy containers
directly on the worker nodes.
• Container is encapsulated in to a
Kubernetes Object named POD.
• A POD is a single instance of an
application.
• A POD is the smallest object that we can
create in Kubernetes.
StackSimplify
© Kalyan Reddy Daida
Kubernetes - POD
Worker Node - 1
POD
Kubernetes Cluster
N
• PODs generally have one to one relationship with containers.
• To scale up we create new POD and to scale down we delete the POD.
POD POD
N
N
Worker Node - 2
POD
N
StackSimplify
© Kalyan Reddy Daida
Kubernetes – PODs
Worker Node - 1
Kubernetes Cluster
POD
N N
POD
N
Worker Node - 2
• We cannot have multiple containers of same kind in a single POD.
• Example: Two NGINX containers in single POD serving same purpose is not
recommended.
POD
N
POD
N
StackSimplify
© Kalyan Reddy Daida
Kubernetes – Multi-Container Pods
Node
POD
Worker Node
Kubernetes Cluster
N H
Helper
Containers
• We can have multiple containers in a single
POD, provided they are not of same kind.
• Helper Containers (Side-car)
• Data Pullers: Pull data required by Main Container
• Data pushers: Push data by collecting from main
container (logs)
• Proxies: Writes static data to html files using
Helper container and Reads using Main Container.
• Communication
• The two containers can easily communicate with
each other easily as they share same network
space.
• They can also easily share same storage space.
• Multi-Container Pods is a rare use-case and we
will try to focus on core fundamentals.
StackSimplify
© Kalyan Reddy Daida
Kubernetes
PODs
Demo
StackSimplify
© Kalyan Reddy Daida
Kubernetes
Services - NodePort
StackSimplify
© Kalyan Reddy Daida
Kubernetes – Service - NodePort
Node
Worker Node
Kubernetes Cluster
Node
Worker Node
POD
N
Worker Node
• We can expose an application running on a set
of PODs using different types of Services
available in k8s.
• ClusterIP
• NodePort
• LoadBalancer
• NodePort Service
• To access our application outside of k8s cluster, we
can use NodePort service.
• Exposes the Service on each Worker Node's IP at a
static port (nothing but NodePort).
• A ClusterIP Service, to which the NodePort Service
routes, is automatically created.
• Port Range 30000-32767
targetPort: 80
Port: 80
Service
NodePort: 3xxx
User
Worker NodePort
ClusterIP Service Port
Container Port in a
POD
http://<Worker-Node-IP>:<NodePort>
StackSimplify
© Kalyan Reddy Daida
Kubernetes
POD & NodePort
Service
Demo
StackSimplify
© Kalyan Reddy Daida
Kubernetes
ReplicaSets
StackSimplify
© Kalyan Reddy Daida
Kubernetes - ReplicaSets
ReplicaSets
High Availability or Reliability
Scaling
Load Balancing
Labels & Selectors
StackSimplify
© Kalyan Reddy Daida
• A ReplicaSet’s purpose is to maintain a
stable set of replica Pods running at
any given time.
Kubernetes – ReplicaSet
Worker Node
Kubernetes Cluster
POD
N
POD
N
ReplicaSet
POD
N
• If our application crashes (any pod dies),
replicaset will recreate the pod immediately
to ensure the configured number of pods
running at any given time.
Reliability
Or
High Availability
StackSimplify
© Kalyan Reddy Daida
Kubernetes – ReplicaSet
Worker Node
Kubernetes Cluster
Worker Node
POD
N
POD
N
POD
N
POD
N
ReplicaSet
• Load Balancing
• To avoid overloading of
traffic to single pod we can
use load balancing.
• Kubernetes provides pod
load balancing out of the
box using Services for the
pods which are part of a
ReplicaSet
• Labels & Selectors are the
key items which ties all 3
together (Pod, ReplicaSet &
Service), we will know in
detail when we are writing
YAML manifests for these
objects
Service
StackSimplify
© Kalyan Reddy Daida
Kubernetes – ReplicaSet
Worker Node
Kubernetes Cluster
Worker Node
POD
N
POD
N
POD
N
POD
N
ReplicaSet
• Scaling
• When load become too
much for the number of
existing pods, Kubernetes
enables us to easily scale
up our application, adding
additional pods as
needed.
• This is going to be
seamless and super quick.
Service
StackSimplify
© Kalyan Reddy Daida
Kubernetes
ReplicaSets
Demo
StackSimplify
© Kalyan Reddy Daida
Kubernetes
Deployments
StackSimplify
© Kalyan Reddy Daida
Kubernetes – Deployments
Worker Node - 1
Kubernetes Cluster
Worker Node - 2
POD
N
POD
N
POD
N
POD
N
ReplicaSet
Deployment
Service
StackSimplify
© Kalyan Reddy Daida
Kubernetes - Deployment
Deployments
Create a Deployment to rollout a ReplicaSet
Updating the Deployment
Rolling Back a Deployment
Scaling a Deployment
Pausing and Resuming a Deployment
Deployment Status
Clean up Policy
Canary Deployments
StackSimplify
© Kalyan Reddy Daida
Kubernetes
Deployments
Demo
StackSimplify
© Kalyan Reddy Daida
Kubernetes
Services
StackSimplify
© Kalyan Reddy Daida
Kubernetes - Services
Services
ClusterIP
NodePort
LoadBalancer
Ingress
externalName
Used for communication between applications inside k8s cluster
(Example: Frontend application accessing backend application)
Used for accessing applications outside of of k8s cluster using Worker
Node Ports (Example: Accessing Frontend application on browser)
Primarily for Cloud Providers to integrate with their Load Balancer
services (Example: AWS Elastic Load Balancer)
Ingress is an advanced load balancer which provides Context path
based routing, SSL, SSL Redirect and many more (Example: AWS ALB)
To access externally hosted apps in k8s cluster (Example: Access AWS
RDS Database endpoint by application present inside k8s cluster)
StackSimplify
© Kalyan Reddy Daida
POD
N
POD
N
ReplicaSet
Deployment (app=frontend)
Frontend App – NodePort or LoadBalancer or Ingress Service
POD POD
ReplicaSet
Deployment (app=Backend)
Backend App - ClusterIP Service
B B
POD
B
POD
N
Kubernetes Cluster
DB
–
ExternalName
Service
AWS Cloud
AWS RDS Database
Users
Services
StackSimplify
© Kalyan Reddy Daida
Kubernetes
Services
Demo
StackSimplify
© Kalyan Reddy Daida
POD
N
ReplicaSet
Deployment (app=frontend)
Frontend App – NodePort Service
POD
ReplicaSet
Deployment (app=Backend)
Backend App - ClusterIP Service
B
Kubernetes Cluster
Users
Services Demo
http://<workernode-public-ip>:<NodePort>/hello
StackSimplify
© Kalyan Reddy Daida
Kubernetes
YAML Basics
StackSimplify
© Kalyan Reddy Daida
• YAML is not a Markup Language
• YAML is used to store information about different things
• We can use YAML to define key, Value pairs like variables, lists and
objects
• YAML is very similar to JSON (Javascript Object Notation)
• YAML primarily focuses on readability and user friendliness
• YAML is designed to be clean and easy to read
• We can define YAML files with two different extensions
• abc.yml
• abc.yaml
YAML Basics
StackSimplify
© Kalyan Reddy Daida
• YAML Comments
• YAML Key Value Pairs
• YAML Dictionary or Map
• YAML Array / Lists
• YAML Spaces
• YAML Document Separator
YAML Basics
StackSimplify
© Kalyan Reddy Daida
THANK YOU

More Related Content

PDF
Kubernetes Basics
PDF
Introduction to kubernetes
PDF
Amazon EKS를 위한 AWS CDK와 CDK8s 활용법 - 염지원, 김광영 AWS 솔루션즈 아키텍트 :: AWS Summit Seou...
PDF
Project calico - introduction
PPTX
A brief study on Kubernetes and its components
PPTX
Kubernetes 101
PPTX
쿠버네티스 ( Kubernetes ) 소개 자료
PDF
Kubernetes Networking
Kubernetes Basics
Introduction to kubernetes
Amazon EKS를 위한 AWS CDK와 CDK8s 활용법 - 염지원, 김광영 AWS 솔루션즈 아키텍트 :: AWS Summit Seou...
Project calico - introduction
A brief study on Kubernetes and its components
Kubernetes 101
쿠버네티스 ( Kubernetes ) 소개 자료
Kubernetes Networking

What's hot (20)

PPTX
Kubernetes Introduction
PDF
모두의 쿠버네티스 (Kubernetes for everyone)
PPTX
Introduction to Kubernetes
PDF
Hands-On Introduction to Kubernetes at LISA17
PDF
Introduction to Docker
PPTX
01. Kubernetes-PPT.pptx
PDF
Kubernetes Interview Questions And Answers | Kubernetes Tutorial | Kubernetes...
PDF
Kubernetes architecture
PDF
Introduction to kubernetes
PDF
Docker & kubernetes
PPTX
Kubernetes Basics
PDF
Docker Introduction
PPTX
Kubernetes
PPTX
Kubernetes Networking 101
PDF
An Introduction to Kubernetes
PPTX
Azure kubernetes service (aks)
PPTX
Kubernetes 101
PDF
Kubernetes Networking
PDF
G Suite: Deployment Services Specialist Exam
Kubernetes Introduction
모두의 쿠버네티스 (Kubernetes for everyone)
Introduction to Kubernetes
Hands-On Introduction to Kubernetes at LISA17
Introduction to Docker
01. Kubernetes-PPT.pptx
Kubernetes Interview Questions And Answers | Kubernetes Tutorial | Kubernetes...
Kubernetes architecture
Introduction to kubernetes
Docker & kubernetes
Kubernetes Basics
Docker Introduction
Kubernetes
Kubernetes Networking 101
An Introduction to Kubernetes
Azure kubernetes service (aks)
Kubernetes 101
Kubernetes Networking
G Suite: Deployment Services Specialist Exam
Ad

Similar to Kubernetes-Fundamentals.pptx (20)

PPTX
Getting Started with Amazon EKS (Managed Kubernetes)
PDF
Kubernetes From Scratch .pdf
PDF
(Draft) Kubernetes - A Comprehensive Overview
PPTX
Kubernetes PPT.pptx
PDF
Kubernetes - A Comprehensive Overview
PDF
Kubernetes acomprehensiveoverview
PDF
Kubernetes a comprehensive overview
PPTX
aks_training_document_Azure_kuberne.pptx
PDF
Kubernetes/ EKS - 김광영 (AWS 솔루션즈 아키텍트)
PPTX
Kubernetes fundamentals
PPTX
08 - kubernetes.pptx
PPTX
01 - VMUGIT - Lecce 2018 - Fabio Rapposelli, VMware
PPTX
Working with kubernetes
PPTX
Kubernetes
PDF
A quick introduction to AKS
PDF
EKS Workshop
PDF
Running kubernetes
PPTX
Kubernetes-introduction to kubernetes for beginers.pptx
PPTX
Introduction+to+Kubernetes-Details-D.pptx
PDF
Kubernetes111111111111111111122233334334
Getting Started with Amazon EKS (Managed Kubernetes)
Kubernetes From Scratch .pdf
(Draft) Kubernetes - A Comprehensive Overview
Kubernetes PPT.pptx
Kubernetes - A Comprehensive Overview
Kubernetes acomprehensiveoverview
Kubernetes a comprehensive overview
aks_training_document_Azure_kuberne.pptx
Kubernetes/ EKS - 김광영 (AWS 솔루션즈 아키텍트)
Kubernetes fundamentals
08 - kubernetes.pptx
01 - VMUGIT - Lecce 2018 - Fabio Rapposelli, VMware
Working with kubernetes
Kubernetes
A quick introduction to AKS
EKS Workshop
Running kubernetes
Kubernetes-introduction to kubernetes for beginers.pptx
Introduction+to+Kubernetes-Details-D.pptx
Kubernetes111111111111111111122233334334
Ad

Recently uploaded (20)

PPTX
Tartificialntelligence_presentation.pptx
PDF
A comparative analysis of optical character recognition models for extracting...
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
NewMind AI Weekly Chronicles - August'25-Week II
PPTX
TechTalks-8-2019-Service-Management-ITIL-Refresh-ITIL-4-Framework-Supports-Ou...
PDF
A comparative study of natural language inference in Swahili using monolingua...
PDF
Getting Started with Data Integration: FME Form 101
PPTX
1. Introduction to Computer Programming.pptx
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Empathic Computing: Creating Shared Understanding
PDF
Spectral efficient network and resource selection model in 5G networks
PPTX
cloud_computing_Infrastucture_as_cloud_p
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Accuracy of neural networks in brain wave diagnosis of schizophrenia
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PPTX
OMC Textile Division Presentation 2021.pptx
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Tartificialntelligence_presentation.pptx
A comparative analysis of optical character recognition models for extracting...
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Advanced methodologies resolving dimensionality complications for autism neur...
NewMind AI Weekly Chronicles - August'25-Week II
TechTalks-8-2019-Service-Management-ITIL-Refresh-ITIL-4-Framework-Supports-Ou...
A comparative study of natural language inference in Swahili using monolingua...
Getting Started with Data Integration: FME Form 101
1. Introduction to Computer Programming.pptx
Mobile App Security Testing_ A Comprehensive Guide.pdf
Empathic Computing: Creating Shared Understanding
Spectral efficient network and resource selection model in 5G networks
cloud_computing_Infrastucture_as_cloud_p
Diabetes mellitus diagnosis method based random forest with bat algorithm
Reach Out and Touch Someone: Haptics and Empathic Computing
Accuracy of neural networks in brain wave diagnosis of schizophrenia
Building Integrated photovoltaic BIPV_UPV.pdf
OMC Textile Division Presentation 2021.pptx
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...

Kubernetes-Fundamentals.pptx

  • 1. StackSimplify Kubernetes for Absolute Beginners on AWS Cloud Kalyan Reddy Daida
  • 2. StackSimplify © Kalyan Reddy Daida Kubernetes on AWS Cloud Course Outline
  • 3. StackSimplify © Kalyan Reddy Daida Kubernetes on AWS Cloud Pod ReplicaSet Deployment Service YAML & kubectl Pod ReplicaSet Deployment Service kubectl Kubernetes Fundamentals Imperative Declarative AWS EKS Cluster YAML K8S Live Template writing
  • 4. StackSimplify © Kalyan Reddy Daida Kubernetes for Absolute Beginners on AWS Cloud | Part-1 Kubernetes for Absolute Beginners on AWS Cloud | Part-2 Free Courses – 2 Hours limitation on Udemy
  • 5. StackSimplify © Kalyan Reddy Daida AWS EKS CLIs
  • 6. StackSimplify © Kalyan Reddy Daida AWS EKS Cluster - CLIs CLIs AWS CLI kubectl eksctl We can control multiple AWS services from the command line and automate them through scripts. We can control Kubernetes clusters and objects using kubectl 1. eksctl is used for creating & deleting clusters on AWS EKS. 2. We can even create, autoscale and delete node groups. 3. We can even create fargate profiles using eksctl 4. In short, it is VERY VERY POWERFUL tool for managing EKS clusters on AWS.
  • 7. StackSimplify © Kalyan Reddy Daida AWS EKS Cluster
  • 8. StackSimplify © Kalyan Reddy Daida AWS EKS – Core Objects EKS Cluster EKS Control Plane Worker Nodes & Node Groups Fargate Profiles (Serverless) VPC Contains Kubernetes Master components like etcd, kube- apiserver, kube- controller. It’s a managed service by AWS Group of EC2 Instances where we run our Application workloads Instead of EC2 Instances, we run our Application workloads on Serverless Fargate profiles With AWS VPC we follow secure networking standards which will allow us to run production workloads on EKS.
  • 9. StackSimplify © Kalyan Reddy Daida How does EKS work? © Amazon
  • 10. StackSimplify © Kalyan Reddy Daida EKS Control Plane 1. EKS runs a single tenant Kubernetes control plane for each cluster, and control plane infrastructure is not shared across clusters or AWS accounts. 2. This control plane consists of at least two API server nodes and three etcd nodes that run across three Availability Zones within a Region 3. EKS automatically detects and replaces unhealthy control plane instances, restarting them across the Availability Zones within the Region as needed. Worker Nodes & Node Groups 1. Worker machines in Kubernetes are called nodes. These are EC2 Instances 2. EKS worker nodes run in our AWS account and connect to our cluster's control plane via the cluster API server endpoint. 3. A node group is one or more EC2 instances that are deployed in an EC2 Autoscaling group. 4. All instances in a node group must 1. Be the same instance type 2. Be running the same AMI 3. Use the same EKS worker node IAM role EKS Cluster – Core Objects Detailed
  • 11. StackSimplify © Kalyan Reddy Daida Fargate Profiles 1. AWS Fargate is a technology that provides on-demand, right-sized compute capacity for containers 2. With Fargate, we no longer have to provision, configure, or scale groups of virtual machines to run containers. 3. Each pod running on Fargate has its own isolation boundary and does not share the underlying kernel, CPU resources, memory resources, or elastic network interface with another pod. 4. AWS specially built Fargate controllers that recognizes the pods belonging to fargate and schedules them on Fargate profiles. 5. We will see more in our Fargate learning section. VPC 1. EKS uses AWS VPC network policies to restrict traffic between control plane components to within a single cluster. 2. Control plane components for a EKS cluster cannot view or receive communication from other clusters or other AWS accounts, except as authorized with Kubernetes RBAC policies. 3. This secure and highly-available configuration makes EKS reliable and recommended for production workloads. EKS Cluster – Core Objects Detailed
  • 12. StackSimplify © Kalyan Reddy Daida Kubernetes Architecture
  • 13. StackSimplify © Kalyan Reddy Daida Kubernetes Architecture
  • 14. StackSimplify © Kalyan Reddy Daida Kubernetes - Architecture Kube Controller Manager Cloud Controller Manager kube-apiserver kube- scheduler etcd Container Runtime (Docker) Master Kube-Proxy Worker Node Kubelet Container Runtime (Docker) Kube-Proxy Worker Node Kubelet Container Runtime (Docker)
  • 15. StackSimplify © Kalyan Reddy Daida Kubernetes Architecture - Master Kube Controller Manager Cloud Controller Manager kube-apiserver kube- scheduler etcd Container Runtime (Docker) Master • kube-apiserver • It acts as front end for the Kubernetes control plane. It exposes the Kubernetes API • Command line tools (like kubectl), Users and even Master components (scheduler, controller manager, etcd) and Worker node components like (Kubelet) everything talk with API Server. • etcd • Consistent and highly-available key value store used as Kubernetes’ backing store for all cluster data. • It stores all the masters and worker node information. • kube-scheduler • Scheduler is responsible for distributing containers across multiple nodes. • It watches for newly created Pods with no assigned node, and selects a node for them to run on.
  • 16. StackSimplify © Kalyan Reddy Daida Kubernetes Architecture - Master Kube Controller Manager Cloud Controller Manager kube-apiserver kube- scheduler etcd Container Runtime (Docker) Master • kube-controller-manager • Controllers are responsible for noticing and responding when nodes, containers or endpoints go down. They make decisions to bring up new containers in such cases. • Node Controller: Responsible for noticing and responding when nodes go down. • Replication Controller: Responsible for maintaining the correct number of pods for every replication controller object in the system. • Endpoints Controller: Populates the Endpoints object (that is, joins Services & Pods) • Service Account & Token Controller: Creates default accounts and API Access for new namespaces.
  • 17. StackSimplify © Kalyan Reddy Daida Kubernetes Architecture - Master Kube Controller Manager Cloud Controller Manager kube-apiserver kube- scheduler etcd Container Runtime (Docker) Master • cloud-controller-manager • A Kubernetes control plane component that embeds cloud-specific control logic. • It only runs controllers that are specific to your cloud provider. • On-Premise Kubernetes clusters will not have this component. • Node controller: For checking the cloud provider to determine if a node has been deleted in the cloud after it stops responding • Route controller: For setting up routes in the underlying cloud infrastructure • Service controller: For creating, updating and deleting cloud provider load balancer
  • 18. StackSimplify © Kalyan Reddy Daida • Kubelet • Kubelet is the agent that runs on every node in the cluster • This agent is responsible for making sure that containers are running in a Pod on a node. • Kube-Proxy • It is a network proxy that runs on each node in your cluster. • It maintains network rules on nodes • In short, these network rules allow network communication to your Pods from network sessions inside or outside of your cluster. Kubernetes Architecture – Worker Nodes Kube-Proxy Worker Node Kubelet Container Runtime (Docker) • Container Runtime • Container Runtime is the underlying software where we run all these Kubernetes components. • We are using Docker, but we have other runtime options like rkt, container-d etc.
  • 19. StackSimplify © Kalyan Reddy Daida AWS EKS Cluster
  • 20. StackSimplify © Kalyan Reddy Daida EKS Kubernetes - Architecture EKS Controller Manager Fargate Controller Manager kube-apiserver kube- scheduler etcd Container Runtime (Docker) Master Kube-Proxy Worker Node -1 Kubelet Container Runtime (Docker) Kube-Proxy Worker Node - 2 Kubelet Container Runtime (Docker) EKS Control Plane EKS Node Group
  • 21. StackSimplify © Kalyan Reddy Daida Kubernetes Fundamentals Pod, ReplicaSet, Deployment & Service
  • 22. StackSimplify © Kalyan Reddy Daida Kubernetes - Fundamentals Pod ReplicaSet Deployment Service k8s Fundamentals A POD is a single instance of an Application. A POD is the smallest object, that you can create in Kubernetes. A ReplicaSet will maintain a stable set of replica Pods running at any given time. In short, it is often used to guarantee the availability of a specified number of identical Pods A Deployment runs multiple replicas of your application and automatically replaces any instances that fail or become unresponsive. Rollout & rollback changes to applications. Deployments are well- suited for stateless applications. A service is an abstraction for pods, providing a stable, so called virtual IP (VIP) address. In simple terms, service sits Infront of a POD and acts as a load balancer.
  • 23. StackSimplify © Kalyan Reddy Daida Kubernetes - Imperative & Declarative Pod ReplicaSet Deployment Service YAML & kubectl Pod ReplicaSet Deployment Service kubectl Kubernetes Fundamentals Imperative Declarative
  • 24. StackSimplify © Kalyan Reddy Daida Kubernetes POD
  • 25. StackSimplify © Kalyan Reddy Daida Kubernetes - POD Worker Node Kubernetes Cluster Node N Nginx Container Image POD N Worker Node POD N Worker Node • With Kubernetes our core goal will be to deploy our applications in the form of containers on worker nodes in a k8s cluster. • Kubernetes does not deploy containers directly on the worker nodes. • Container is encapsulated in to a Kubernetes Object named POD. • A POD is a single instance of an application. • A POD is the smallest object that we can create in Kubernetes.
  • 26. StackSimplify © Kalyan Reddy Daida Kubernetes - POD Worker Node - 1 POD Kubernetes Cluster N • PODs generally have one to one relationship with containers. • To scale up we create new POD and to scale down we delete the POD. POD POD N N Worker Node - 2 POD N
  • 27. StackSimplify © Kalyan Reddy Daida Kubernetes – PODs Worker Node - 1 Kubernetes Cluster POD N N POD N Worker Node - 2 • We cannot have multiple containers of same kind in a single POD. • Example: Two NGINX containers in single POD serving same purpose is not recommended. POD N POD N
  • 28. StackSimplify © Kalyan Reddy Daida Kubernetes – Multi-Container Pods Node POD Worker Node Kubernetes Cluster N H Helper Containers • We can have multiple containers in a single POD, provided they are not of same kind. • Helper Containers (Side-car) • Data Pullers: Pull data required by Main Container • Data pushers: Push data by collecting from main container (logs) • Proxies: Writes static data to html files using Helper container and Reads using Main Container. • Communication • The two containers can easily communicate with each other easily as they share same network space. • They can also easily share same storage space. • Multi-Container Pods is a rare use-case and we will try to focus on core fundamentals.
  • 29. StackSimplify © Kalyan Reddy Daida Kubernetes PODs Demo
  • 30. StackSimplify © Kalyan Reddy Daida Kubernetes Services - NodePort
  • 31. StackSimplify © Kalyan Reddy Daida Kubernetes – Service - NodePort Node Worker Node Kubernetes Cluster Node Worker Node POD N Worker Node • We can expose an application running on a set of PODs using different types of Services available in k8s. • ClusterIP • NodePort • LoadBalancer • NodePort Service • To access our application outside of k8s cluster, we can use NodePort service. • Exposes the Service on each Worker Node's IP at a static port (nothing but NodePort). • A ClusterIP Service, to which the NodePort Service routes, is automatically created. • Port Range 30000-32767 targetPort: 80 Port: 80 Service NodePort: 3xxx User Worker NodePort ClusterIP Service Port Container Port in a POD http://<Worker-Node-IP>:<NodePort>
  • 32. StackSimplify © Kalyan Reddy Daida Kubernetes POD & NodePort Service Demo
  • 33. StackSimplify © Kalyan Reddy Daida Kubernetes ReplicaSets
  • 34. StackSimplify © Kalyan Reddy Daida Kubernetes - ReplicaSets ReplicaSets High Availability or Reliability Scaling Load Balancing Labels & Selectors
  • 35. StackSimplify © Kalyan Reddy Daida • A ReplicaSet’s purpose is to maintain a stable set of replica Pods running at any given time. Kubernetes – ReplicaSet Worker Node Kubernetes Cluster POD N POD N ReplicaSet POD N • If our application crashes (any pod dies), replicaset will recreate the pod immediately to ensure the configured number of pods running at any given time. Reliability Or High Availability
  • 36. StackSimplify © Kalyan Reddy Daida Kubernetes – ReplicaSet Worker Node Kubernetes Cluster Worker Node POD N POD N POD N POD N ReplicaSet • Load Balancing • To avoid overloading of traffic to single pod we can use load balancing. • Kubernetes provides pod load balancing out of the box using Services for the pods which are part of a ReplicaSet • Labels & Selectors are the key items which ties all 3 together (Pod, ReplicaSet & Service), we will know in detail when we are writing YAML manifests for these objects Service
  • 37. StackSimplify © Kalyan Reddy Daida Kubernetes – ReplicaSet Worker Node Kubernetes Cluster Worker Node POD N POD N POD N POD N ReplicaSet • Scaling • When load become too much for the number of existing pods, Kubernetes enables us to easily scale up our application, adding additional pods as needed. • This is going to be seamless and super quick. Service
  • 38. StackSimplify © Kalyan Reddy Daida Kubernetes ReplicaSets Demo
  • 39. StackSimplify © Kalyan Reddy Daida Kubernetes Deployments
  • 40. StackSimplify © Kalyan Reddy Daida Kubernetes – Deployments Worker Node - 1 Kubernetes Cluster Worker Node - 2 POD N POD N POD N POD N ReplicaSet Deployment Service
  • 41. StackSimplify © Kalyan Reddy Daida Kubernetes - Deployment Deployments Create a Deployment to rollout a ReplicaSet Updating the Deployment Rolling Back a Deployment Scaling a Deployment Pausing and Resuming a Deployment Deployment Status Clean up Policy Canary Deployments
  • 42. StackSimplify © Kalyan Reddy Daida Kubernetes Deployments Demo
  • 43. StackSimplify © Kalyan Reddy Daida Kubernetes Services
  • 44. StackSimplify © Kalyan Reddy Daida Kubernetes - Services Services ClusterIP NodePort LoadBalancer Ingress externalName Used for communication between applications inside k8s cluster (Example: Frontend application accessing backend application) Used for accessing applications outside of of k8s cluster using Worker Node Ports (Example: Accessing Frontend application on browser) Primarily for Cloud Providers to integrate with their Load Balancer services (Example: AWS Elastic Load Balancer) Ingress is an advanced load balancer which provides Context path based routing, SSL, SSL Redirect and many more (Example: AWS ALB) To access externally hosted apps in k8s cluster (Example: Access AWS RDS Database endpoint by application present inside k8s cluster)
  • 45. StackSimplify © Kalyan Reddy Daida POD N POD N ReplicaSet Deployment (app=frontend) Frontend App – NodePort or LoadBalancer or Ingress Service POD POD ReplicaSet Deployment (app=Backend) Backend App - ClusterIP Service B B POD B POD N Kubernetes Cluster DB – ExternalName Service AWS Cloud AWS RDS Database Users Services
  • 46. StackSimplify © Kalyan Reddy Daida Kubernetes Services Demo
  • 47. StackSimplify © Kalyan Reddy Daida POD N ReplicaSet Deployment (app=frontend) Frontend App – NodePort Service POD ReplicaSet Deployment (app=Backend) Backend App - ClusterIP Service B Kubernetes Cluster Users Services Demo http://<workernode-public-ip>:<NodePort>/hello
  • 48. StackSimplify © Kalyan Reddy Daida Kubernetes YAML Basics
  • 49. StackSimplify © Kalyan Reddy Daida • YAML is not a Markup Language • YAML is used to store information about different things • We can use YAML to define key, Value pairs like variables, lists and objects • YAML is very similar to JSON (Javascript Object Notation) • YAML primarily focuses on readability and user friendliness • YAML is designed to be clean and easy to read • We can define YAML files with two different extensions • abc.yml • abc.yaml YAML Basics
  • 50. StackSimplify © Kalyan Reddy Daida • YAML Comments • YAML Key Value Pairs • YAML Dictionary or Map • YAML Array / Lists • YAML Spaces • YAML Document Separator YAML Basics
  • 51. StackSimplify © Kalyan Reddy Daida THANK YOU