Introduction to Amazon EKS-2024
Introduction to Amazon EKS-2024
© 2024, Amazon Web Services, Inc. or its affiliates. All rights reserved.
First things first…
© 2024, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Application environment components
Runtime Code
Engine
Dependencies Configuration
© 2024, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Different environments
© 2024, Amazon Web Services, Inc. or its affiliates. All rights reserved.
It worked on my machine, why not in prod?
© 2024, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Containers to the rescue
Runtime Engine
Dependencies
Code
© 2024, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Containers vs VMs
Containers Virtual Machines
- Using Linux primitives for - Virtualisation or emulate
isolation hardware components
- Share Linux Kernel - Completely separate kernels
- Fast starts, minimal overhead (maybe not Linux)
- Flexible isolation - Slower starts, must boot kernel
and set-up hardware.
Container Container VM Guest VM Guest
Hardware Hardware
© 2024, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Container images
W
• Read only image that is used
rit
ab
as a template to launch a
ad
le
container. Container
d
N
GI
N
ad
X
Image
d
References
n
• Start from base images that
od unt
parent
ej
have your dependencies, add image
U
Image
s
b
your custom code.
u
Base image
© 2024, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Four environments, same container
© 2024, Amazon Web Services, Inc. or its affiliates. All rights reserved.
What is Kubernetes?
https://kubernetes.io/docs/tutorials/kubernetes-basics/
© 2024, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Kubernetes basic architecture
© 2024, Amazon Web Services, Inc. or its affiliates. All rights reserved.
What is Kubernetes?
Objects Objects
Pod Job
A thin wrapper around one or more containers Ensures a pod properly runs to completion
DaemonSet Service
Implements a single instance of a pod on a Maps a fixed IP address to a logical group of pods
worker node
Label
Deployment
Key/Value pairs used for association and filtering
Details how to roll out (or roll back) across
versions of your application kubectl
ReplicaSet Command line interface
© 2024, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Amazon EKS
© 2024, Amazon Web Services, Inc. or its affiliates. All rights reserved.
What is Amazon EKS?
Amazon EKS runs vanilla Kubernetes; EKS is upstream and a
certified conformant version of Kubernetes (with backported
security fixes)
Amazon EKS supports 4 versions of Kubernetes,
giving you time to test and roll out upgrades
© 2024, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Amazon EKS High Level Architecture
Customer VPC AWS Cloud
© 2024, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Amazon EKS Control Plane Architecture
Survive single-AZ Availability Zone 1 Availability Zone 2 Availability Zone 3
AWS Cloud
events
EKS-managed VPC
NLB NLB NLB
Highly available cluster
endpoint Private subnet
24x7x365 support
Automatic Resizing
© 2024, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Amazon EKS Runtimes Overview
A fully managed
Amazon EKS supports running containers on EC2
container environment
instances or on AWS Fargate. Clusters can run containers with no infrastructure
on a single runtime or multiple runtimes at the same management.
time.
AWS Fargate
© 2024, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Amazon EC2 Runtime Options
Runtime Options
GPU Based Instances Nitro Based Instances AMD Backed Instances Graviton 2 Instances Spot Instances and AWS Outpost AWS Local Zones
Compute Savings Plans
© 2024, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Kubernetes Ingress and The
AWS Load Balancer Controller
© 2024, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Kubernetes Ingress object
© 2024, Amazon Web Services, Inc. or its affiliates. All rights reserved.
AWS Load Balancer Controller
A KUBERNETES CONTROLLER FOR ELASTIC LOAD BALANCERS
© 2024, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Scaling applications with
Kubernetes
© 2024, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Kubernetes Autoscaling
1. Horizontal Pod
Autoscaling (HPA)
HPA
Metrics
Store
2. Vertical Pod
Autoscaling (VPA)
VPA
3. Cluster Autoscaler
(CAS) Pending pods X CAS
© 2024, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Kubernetes Autoscaling
1. Horizontal Pod
Autoscaling (HPA)
HPA
Metrics
Store
2. Vertical Pod
Autoscaling (VPA)
VPA
Scale up ASG
X
3. Cluster Autoscaler
(CAS)
Pending pods CAS
© 2024, Amazon Web Services, Inc. or its affiliates. All rights reserved.
API call to ASG
What is Karpenter?
Karpenter is an open-source, flexible, and high-performance
Kubernetes cluster autoscaler.
© 2024, Amazon Web Services, Inc. or its affiliates. All rights reserved.
How Karpenter Works
Pending pods Existing capacity • Deeply integrated with EC2
§ EC2 Fleet API, no ASGs
Right-sized instances.
No ASGs to manage • Karpenter terminates
API call to EC2
underutilized nodes
© 2024, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Kubernetes Security
© 2024, Amazon Web Services, Inc. or its affiliates. All rights reserved.
EKS – Self Managed Workers
Customer Data
Controller Manager
AWS Responsibility
Customer Responsibility
API Server
Scheduler
Container Images, Source Code, IAM
Cluster Add-
Pod Security
HPA & VPA
Disruption
Quotas &
Bindings
Network
Budgets
Policies
Policies
Priority
RBAC
Ons
EKS Cluster Configuration Pod
ETCD
Worker Node Scaling VPC Configuration
Customer Data
Controller Manager
AWS Responsibility
Customer Responsibility
API Server
Scheduler
Container Images, Source Code, IAM
Cluster Add-
Pod Security
HPA & VPA
Disruption
Quotas &
Bindings
Network
Budgets
Policies
Policies
Priority
RBAC
Ons
EKS Cluster Configuration Pod
ETCD
Worker Node Scaling VPC Configuration
Disruption
Budgets
© 2024, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Customer Data
Quotas &
Limit Ranges
RBAC
Bindings
Network
Policies
Kubernetes Networking
© 2024, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Kubernetes networking model
• Every Pod gets its own
IP address
• Containers in the same Pod
share the network (IP address)
• Pods communicate to other
Pods without NAT
Container Network
Interface plugin
© 2024, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Pod IPv4 networking – CNI plugin
Your VPC
The Amazon VPC Container Network Interface (CNI)
plugin is used for
Worker subnet - Creating and attaching ENIs to worker nodes
- Assigning secondary IP addresses for Pods
Primary ENI - Wiring the host network
PRIMARY IP: 10.0.0.20
SECONDARY IPs:
- 10.0.0.101
10.0.0.101 10.0.1.203 10.0.2.123 - 10.0.1.203
- 10.0.2.123
Secondary ENI
PRIMARY IP: 10.0.0.30
Alternatives to Amazon VPC CNI
SECONDARY IPs:
10.0.1.64 10.0.0.32 10.0.2.67
- 10.0.1.64 - Calico from Tigera
- 10.0.0.32
- 10.0.2.67
- Cilium from Isovalent
- Weave Net from Weaveworks
Worker node - Antrea from VMware
© 2024, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Amazon CNI – Configuration options
• Prefix delegation
kubectl set env daemonset aws-node -n kube-system ENABLE_PREFIX_DELEGATION=true/false
• Custom networking
kubectl set env daemonset aws-node -n kube-system AWS_VPC_K8S_CNI_CUSTOM_NETWORK_CFG=true/false
© 2024, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Secondary IPs for Pods per EC2 instance
1x ENI IP
9x secondary
IPs
1x ENI IP
9x secondary
IPs
1x ENI IP
9x secondary
IPs
m5.large
MAX PODS = (Number of network interfaces × [the number of IP addresses per network interface – 1]) + 2
29
© 2024, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Amazon VPC prefix delegation
© 2024, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Prefix delegation
1x IP
9x delegations
1x IP
9x delegations
1x IP
9x delegations
m5.large
DELEGATED PREFIX:
10.0.1.1 10.0.1.5 10.0.1.17 10.0.1.0/28 (16x IPs)
10.0.1.16/28 (16x IPs)
[…]
Secondary ENI
PRIMARY IP: 10.0.0.30
DELEGATED PREFIX:
10.0.3.3 10.0.3.6 10.0.3.7
10.0.3.0/28 (16x IPs)
Worker node
Primary ENI /24 VPC CIDR provides 251 unique IPv4 addresses
PRIMARY IP: 10.0.0.20
SECONDARY IPs:
- 10.0.0.11
10.0.0.11 10.0.0.23 10.0.0.12 - 10.0.0.23
- 10.0.0.12
Secondary ENI
PRIMARY IP: 10.0.0.30
SECONDARY IPs:
10.0.0.61 10.0.0.32 10.0.0.55 - 10.0.0.61
- 10.0.0.32
- 10.0.0.55
Worker Node
© 2024, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Pod networking – Custom networking
Your VPC +
100.64.0.0/16
VPCs can have multiple IPv4 CIDR ranges
SECONDARY IPs:
100.64.0.61 100.64.11.3 100.64.9.17
- 100.64.0.61
- 100.64.11.3
- 100.64.9.17
Worker node
© 2024, Amazon Web Services, Inc. or its affiliates. All rights reserved.