SlideShare une entreprise Scribd logo
1  sur  65
Télécharger pour lire hors ligne
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Workshop: Deep Dive on Container Networking
at Scale on Amazon EKS, Amazon ECS, &
Amazon EC2
N E T 4 1 0
Liwen Wu
Software Development Engineer
Amazon Web Services
Ikenna Izugbokwe
Sr. Solutions Architect
Amazon Web Services
Pratik Mankad
Partner Solutions Architect
Amazon Web Services
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Agenda
• Workshop environment
• ECS networking
• Kubernetes:
• Key concepts and architecture
• Networking requirements
• Networking implementation
• Amazon EKS:
• EC2 and VPC considerations
• CNI details
• Kubernetes on EC2: Kops
• Workshop activity: Amazon EKS & Kubernetes on EC2 (Kops)
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Workshop Environment Setup…
• Launch CloudFormation template:
• GitHub: https://github.com/liwenwu -amazon/reinvent2018-NET410
• CloudFormation template creates:
• Two Amazon EC2 instances (workshop instances)
• Sets up environment
• Two kubernetes clusters:
1. Kops Cluster
2. EKS Cluster
• Two EC2 instances for workshop activities:
• net410-workshop-kops-mgmt
• net410-workshop-eks-mgmt
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Deployment Options
Amazon EC2
Kubernetes
+
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
ECS networkMode: none
EC2
Task 1
lo
eth0
10.1.1.11
127.0.0.1
• Disables all networking
• IP for the container not
configured
• No access to the external
network as well as for other
containers.
• Has the loopback address.
docker0: 172.17.0.1/16
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
ECS networkMode: host
EC2
Task 1
lo
eth0
10.1.1.11
127.0.0.1
• Shares the host’s
network stack
• All interfaces from the
host will be available
to the container
• Host name will match
the host name on the
host system
• No network isolation
eth0 docker0
10.1.1.11 172.17.0.1
docker0: 172.17.0.1/16
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
ECS networkMode: bridge
EC2
Task 1
eth0
docker0: 172.17.0.1/16eth0
10.1.1.11
172.17.0.2:1234
• Uses software bridge:
docker0
• Containers are attached to
docker bridge
• Own IP address and all TCP
ports are available
• No network isolation
between containers
vethxx
Task 2
eth0
172.17.0.3:4567
vethxx
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
ECS networkMode: bridge
• Container on across EC2 instances…
EC2-1 EC2-2
docker0: 172.17.0.1/16
eth0
10.1.1.11
vethxx
eth0
172.17.0.2:1234
docker0: 172.17.0.1/16
eth0
10.1.2.11
vethxx
eth0
172.17.0.2:4567
Router
Task 1 Task 1
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
ECS networkMode: awsvpc
EC2
• Each task has it’s own
elastic network
interface
• Achieves network isolation
• Security group on the
primary and task ENI
• Container gets its own
addressable IP
ecs-bridge: 169.254.172.1/30
eth0
10.1.1.11
vethxx
ecs-eth0
169.254.172.2/30
Task 1
eth1
10.1.1.12
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
ECS networkMode: awsvpc
EC2-1
10.1.1.12:1234
eth0
eth1
10.1.1.11
EC2-2
10.1.2.12:1234
eth0
eth1
10.1.2.11
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Key Kubernetes concepts:
• Kubernetes Control Plane
• Provided by Master Node Objects/processes
• Kubernetes Data Plane
• Provided by Worker Nodes Objects/processes
• Kubernetes Master Node
• Kube-apiserver
• Kube-controller-manager
• Kube-scheduler
• Kubernetes Worker Nodes
• Kubelet
• Kube-proxy
• Pods
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Kubernetes Master Node
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Kubernetes Worker Node
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Kubernetes objects and examples
• Represent the state of the cluster
• They are records of “intent” or cluster desired state.
• Acted upon by calling k8s API directly from client libraries or via cli –
kubectl
• Identified by a name and a UID
• Labels
• Key/value pair attached to objects. Used by service to define sets of pods (key use case).
• Annotations
• Control load balancer configuration in EKS.
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Kubernetes architecture:
Cloud
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Four networking problems:
• Container-to-container communications
• Pod-to-pod communications
• Pod-to-service communications
• External-to-internal communications
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
What is a pod ...
• Smallest and simplest computing unit
• Group of one or more containers
• Co-located and co-scheduled
• Share a network stack and storage
• Containers within a pod share an IP address
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
From Kubernetes perspective …
• Pods can communicate with other pods
• Every pod gets its own IP address
• Mapping container ports to node (host) port not required
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Kubernetes CNI’s (plugins)
• Kubenet (default for kops)
• Utilizes VPC route table for pod -to-pod traffic between nodes
• Calico
• Uses BGP to distribute routes
• Weave
• All nodes in cluster share same subnet—single L2 broadcast domain
• Flannel
• Leverages VXLAN overlay network
• Amazon-vpc-cni-k8s
• Amazon routed ENI VPC CNI
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
EC2 and VPC considerations—EKS
• AWS EC2 instance type:
• Determine the maximum number of Elastic Network Interfaces ( ENI)
• Determine the number of IP addresses
• Larger instances support more IP addresses:
• c5d.18xlarge supports 15 ENIs and each ENI can support up -to 50 IPv4
addresses
• EKS requires subnets in at least two AZ’s
• Use separate VPC for each EKS cluster
• Warm pool of IP addresses
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
amazon-vpc-cni-k8s Container Networking
Interface (CNI) Tenets:
• Integrates Amazon Virtual Private Cloud networking into Kubernetes
• Should use Amazon VPC networking natively to forward pod-to-pod
traffic
• Use AWS routable IP addresses for Pods
• Pods is 1st class citizen in Amazon VPC networking
• There is NO on-ramp/off-ramp for
• Pod to AWS services (e.g. Amazon S3, Amazon DynamoDB)
communication
• Pod to on-premises communication (e.g. VPN/direct -connect)
• Should make sure pods have fast startup time:
• Pods/Containers MUST be able to send and receive traffic in the matter
of seconds (compare to minutes for VM)
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
CNI networking details—Data plane
VPC network
EC2
POD
L3 routing
POD
L3 routing
POD POD
L3 routing
POD
ENI ENI ENI
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Life of a packet: pod1-to-pod2, inside node
EC2
Pod1
eth0
Pod2
eth0
ENI
root
veth-pod1 veth-pod2
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Life of a packet: pod1-to-pod2, inside node
EC2
Pod1
eth0
Pod2
eth0
ENI
root
veth-pod1 veth-pod2
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Life of a packet: pod1-to-pod2, inside node
EC2
Pod1
eth0
Pod2
eth0
ENI
root
veth-pod1 veth-pod2
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Life of a packet: pod1-to-pod2, inside node
EC2
Pod1
eth0
Pod2
eth0
ENI
root
veth-pod1 veth-pod2
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Life of a packet: pod1-to-pod2, inside node
EC2
Pod1
eth0
Pod2
eth0
ENI
root
veth-pod1 veth-pod2
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Life of a packet: pod1-to-pod3, across nodes
ENI
EC2
node1
Pod1
eth0
Pod2
eth0
root
veth-pod1 veth-pod2
EC2
node2
Pod3
eth0
Pod4
eth0
root
veth-pod3 veth-pod4
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Life of a packet: pod1-to-pod3, across nodes
ENI
EC2
node1
Pod1
eth0
Pod2
eth0
root
veth-pod1 veth-pod2
EC2
node2
Pod3
eth0
Pod4
eth0
root
veth-pod3 veth-pod4
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Life of a packet: pod1-to-pod3, across nodes
ENI
EC2
node1
Pod1
eth0
Pod2
eth0
root
veth-pod1 veth-pod2
EC2
node2
Pod3
eth0
Pod4
eth0
root
veth-pod3 veth-pod4
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Life of a packet: pod1-to-pod3, across nodes
ENI
EC2
node1
Pod1
eth0
Pod2
eth0
root
veth-pod1 veth-pod2
EC2
node2
Pod3
eth0
Pod4
eth0
root
veth-pod3 veth-pod4
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Life of a packet: pod1-to-pod3, across nodes
ENI
EC2
node1
Pod1
eth0
Pod2
eth0
root
veth-pod1 veth-pod2
EC2
node2
Pod3
eth0
Pod4
eth0
root
veth-pod3 veth-pod4
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Life of a packet: pod1-to-pod3, across nodes
ENI
EC2
node1
Pod1
eth0
Pod2
eth0
root
veth-pod1 veth-pod2
EC2
node2
Pod3
eth0
Pod4
eth0
root
veth-pod3 veth-pod4
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Life of a packet: pod1-to-pod3, across nodes
ENI
EC2
node1
Pod1
eth0
Pod2
eth0
root
veth-pod1 veth-pod2
EC2
node2
Pod3
eth0
Pod4
eth0
root
veth-pod3 veth-pod4
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Life of a packet: pod1-to-pod3, across nodes
ENI
EC2
node1
Pod1
eth0
Pod2
eth0
root
veth-pod1 veth-pod2
EC2
node2
Pod3
eth0
Pod4
eth0
root
veth-pod3 veth-pod4
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Kubernetes Service
Service
PodPodPod
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
For example: Kubernetes Service IP (10.100.0.1)
kubectl describe svc
Name: kubernetes
Namespace: default
Labels: component=apiserver
provider=kubernetes
Annotations: <none>
Selector: <none>
Type: ClusterIP
IP: 10.100.0.1
Port: https 443/TCP
TargetPort: 443/TCP
Endpoints: 192.168.119.102:443,192.168
.154.135:443
Session Affinity: ClientIP
Events: <none>
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Kubernetes DNS Pod (kube-dns)
• Kubernetes schedules a DNS Pod (kube-dns) and Service on
the cluster
• Configures the Kubelets to tell individual containers to use
the DNS Service’s IP to resolve DNS names
• DNS Pod communicate with Kubernetes Service IP (e.g
10.100.0.1) and build map of Service Name and Service IP
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Life of a packet: pod (kube-dns)-to-service
(Kubernetes service)
ENI
EC2
node1
Kube-dns
eth0
Pod2
eth0
root
veth-dns-pod veth-pod2
EKS-Owned ENI
192.168.119.102
EKS-Owned EN
192.168.154.135I
Customer VPC EKS VPC
10.100.0.1
APIServer
Availability Zone 1
APIServer
Availability Zone 2
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Life of a packet: pod (kube-dns)-to-service
(Kubernetes service)
ENI
EC2
node1
Kube-dns
eth0
Pod2
eth0
root
veth-dns-pod veth-pod2
EKS-Owned ENI
192.168.119.102
EKS-Owned EN
192.168.154.135I
Customer VPC EKS VPC
10.100.0.1
APIServer
Availability Zone 1
APIServer
Availability Zone 2
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Life of a packet: pod (kube-dns)-to-service
(Kubernetes service)
ENI
EC2
node1
Kube-dns
eth0
Pod2
eth0
root
veth-dns-pod veth-pod2
EKS-Owned ENI
192.168.119.102
EKS-Owned EN
192.168.154.135I
Customer VPC EKS VPC
10.100.0.1
APIServer
Availability Zone 1
APIServer
Availability Zone 2
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Life of a packet: pod (kube-dns)-to-service
(Kubernetes service)
ENI
EC2
node1
Kube-dns
eth0
Pod2
eth0
root
veth-dns-pod veth-pod2
EKS-Owned ENI
192.168.119.102
EKS-Owned EN
192.168.154.135
Customer VPC EKS VPC
APIServer
Availability Zone 1
APIServer
Availability Zone 2
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Life of a packet: pod (kube-dns)-to-service
(Kubernetes service)
ENI
EC2
node1
Kube-dns
eth0
Pod2
eth0
root
veth-dns-pod veth-pod2
EKS-Owned ENI
192.168.119.102
EKS-Owned EN
192.168.154.135I
Customer VPC EKS VPC
APIServer
Availability Zone 1
APIServer
Availability Zone 2
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Life of a packet: pod (kube-dns)-to-service
(Kubernetes service)
ENI
EC2
node1
Kube-dns
eth0
Pod2
eth0
root
veth-dns-pod veth-pod2
EKS-Owned ENI
192.168.119.102
EKS-Owned EN
192.168.154.135I
Customer VPC EKS VPC
APIServer
Availability Zone 1
APIServer
Availability Zone 2
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Life of a packet: pod (kube-dns)-to-service
(Kubernetes service)
ENI
EC2
node1
Kube-dns
eth0
Pod2
eth0
root
veth-dns-pod veth-pod2
EKS-Owned ENI
192.168.119.102
EKS-Owned EN
192.168.154.135I
Customer VPC EKS VPC
APIServer
Availability Zone 1
APIServer
Availability Zone 2
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
CNI networking details—Control plane
• Kubelet invokes CNI add or delete commands for pods
• CNI request secondary IPs from ipamD and setups
networking stack for pod
• For fast pods startup time, IP address manager database
(ipamD) creates a secondary IP warm pool with one more
ENI and its IP address
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
CNI Networking details—Control plane
EC2
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Networking explained …
eth0 eth0
vethxxxx vethxxxx
eth0
crb0
EC2
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Pod-to-Pod Communications (kops):
EC2
Pod 1
eth0 eth0
vethxxxxvethxxxx
crb0: 100.65.129.1eth0
10.0.1.11
• Pods on the same instance…
Pod 2
100.65.129.11 100.65.129.12
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Pod-to-Pod Communications (kops):
• Pods across EC2 instances…
EC2-1
eth0
10.1.1.11
crb0: 100.65.130.1
eth0Pod 1
vethxxxx
100.65.130.11
EC2-2
eth0
10.1.2.11
crb0: 100.65.129.1
eth0Pod 2
vethxxxx
100.65.129.11
Router (GW)
100.65.129.0/24
via eni: 10.0.1.11
100.65.130.0/24
via eni: 10.0.1.12
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Pod-to-Service Communications (kops):
EC2-1
eth0
10.0.1.11
crb0: 100.65.130.1
eth0Pod 1
vethxxxx
100.65.130.11
Router (GW)
100.65.130.0/24
via eni: 10.1.1.11
100.65.129.0/24
via eni: 10.1.2.11
kube-proxy
Connect To:
100.65.130.11:8080
iptables:
service xx
endpoints yy
EC2-2
eth0
10.0.1.11
crb0: 100.65.130.1
eth0Pod 2
vethxxxx
100.65.130.11
kube-proxy
SERVICE:
NAME: service-net410
TYPE: ClusterIP
CLUSTER-IP: 100.64.31.116
EXTERNAL-IP: <none>
PORTS: 80/TCP
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
External-to-internal communications (kops):
VPC CIDR: 10.0.0.0/16
eth0
vethxxxx vethxxxx
crb0: 100.64.129.1
eth0
Router: 10.0.1.1
eth0: 10.0.1.11
100.64.129.0/24
via eni: 10.0.1.11
100.64.130.0/24
via eni: 10.0.1.12
100,64.129.11
eth0
100,64.129.12
kube-proxy
Iptables
service xx
endpoints yy
EC2-2
eth0
vethxxxx vethxxxx
crb0: 100.64.129.1
eth0
eth0: 10.0.1.12
100,64.130.11
eth0
100,64.130.12
SERVICE:
NAME: service-net410
TYPE: LoadBalancer
CLUSTER-IP: 100.64.31.116
EXTERNAL-IP: LB DNS
PORTS: 80:31787/TCP kube-proxy
Iptables
service xx
endpoints yy
EC2-1
Internet
EC2-1
EC2-2
ELB DNS: a266xxyy.us-west-2.elb.amazonaws.com
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
NET410 workshop activity
• To begin workshop activity:
• Access https://github.com/liwenwu -amazon/reinvent2018-NET410
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
References:
• https://kubernetes.io/
• https://kubernetes.io/docs/concepts/cluster-
administration/networking/
• https://kubernetes.io/docs/concepts/services-networking/service/
• https://aws.amazon.com/blogs/compute/kubernetes-clusters-aws-
kops/
• https://github.com/aws/amazon-vpc-cni-k8s
Thank you!
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Ikenna Izugbokwe
Sr. Solutions Architect
Amazon Web Services
Liwen Wu
Software Development Engineer
Amazon Web Services
Pratik Mankad
Partner Solutions Architect
Amazon Web Services
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.

Contenu connexe

Tendances

Tendances (20)

Cloud formation デザイナーで捗ろう
Cloud formation デザイナーで捗ろうCloud formation デザイナーで捗ろう
Cloud formation デザイナーで捗ろう
 
Deep Dive - CI/CD on AWS
Deep Dive - CI/CD on AWSDeep Dive - CI/CD on AWS
Deep Dive - CI/CD on AWS
 
Introduction to AWS VPC, Guidelines, and Best Practices
Introduction to AWS VPC, Guidelines, and Best PracticesIntroduction to AWS VPC, Guidelines, and Best Practices
Introduction to AWS VPC, Guidelines, and Best Practices
 
Elastic Load Balancing Deep Dive - AWS Online Tech Talk
Elastic  Load Balancing Deep Dive - AWS Online Tech TalkElastic  Load Balancing Deep Dive - AWS Online Tech Talk
Elastic Load Balancing Deep Dive - AWS Online Tech Talk
 
AWS networking fundamentals
AWS networking fundamentalsAWS networking fundamentals
AWS networking fundamentals
 
Open shift 4 infra deep dive
Open shift 4    infra deep diveOpen shift 4    infra deep dive
Open shift 4 infra deep dive
 
Amazon EKS - security best practices - 2022
Amazon EKS - security best practices - 2022 Amazon EKS - security best practices - 2022
Amazon EKS - security best practices - 2022
 
Kubernetes on AWS with Amazon EKS - MAD301 - New York AWS Summit
Kubernetes on AWS with Amazon EKS - MAD301 - New York AWS SummitKubernetes on AWS with Amazon EKS - MAD301 - New York AWS Summit
Kubernetes on AWS with Amazon EKS - MAD301 - New York AWS Summit
 
OpenShift Virtualization- Technical Overview.pdf
OpenShift Virtualization- Technical Overview.pdfOpenShift Virtualization- Technical Overview.pdf
OpenShift Virtualization- Technical Overview.pdf
 
Kubernetes on AWS with Amazon EKS
Kubernetes on AWS with Amazon EKSKubernetes on AWS with Amazon EKS
Kubernetes on AWS with Amazon EKS
 
AWS Direct Connect
AWS Direct ConnectAWS Direct Connect
AWS Direct Connect
 
K8s on AWS: Introducing Amazon EKS
K8s on AWS: Introducing Amazon EKSK8s on AWS: Introducing Amazon EKS
K8s on AWS: Introducing Amazon EKS
 
Amazon ECS
Amazon ECSAmazon ECS
Amazon ECS
 
AWS Connectivity, VPC Design and Security Pro Tips
AWS Connectivity, VPC Design and Security Pro TipsAWS Connectivity, VPC Design and Security Pro Tips
AWS Connectivity, VPC Design and Security Pro Tips
 
Amazon EKS - Elastic Container Service for Kubernetes
Amazon EKS - Elastic Container Service for KubernetesAmazon EKS - Elastic Container Service for Kubernetes
Amazon EKS - Elastic Container Service for Kubernetes
 
Introduction to Kubernetes
Introduction to KubernetesIntroduction to Kubernetes
Introduction to Kubernetes
 
Deep Dive: AWS Command Line Interface
Deep Dive: AWS Command Line InterfaceDeep Dive: AWS Command Line Interface
Deep Dive: AWS Command Line Interface
 
Docker Networking - Common Issues and Troubleshooting Techniques
Docker Networking - Common Issues and Troubleshooting TechniquesDocker Networking - Common Issues and Troubleshooting Techniques
Docker Networking - Common Issues and Troubleshooting Techniques
 
Kubernetes Networking with Cilium - Deep Dive
Kubernetes Networking with Cilium - Deep DiveKubernetes Networking with Cilium - Deep Dive
Kubernetes Networking with Cilium - Deep Dive
 
(NET406) Deep Dive: AWS Direct Connect and VPNs
(NET406) Deep Dive: AWS Direct Connect and VPNs(NET406) Deep Dive: AWS Direct Connect and VPNs
(NET406) Deep Dive: AWS Direct Connect and VPNs
 

Similaire à Deep Dive on Container Networking at Scale on Amazon EKS, Amazon ECS, & Amazon EC2 (NET410) - AWS re:Invent 2018

Similaire à Deep Dive on Container Networking at Scale on Amazon EKS, Amazon ECS, & Amazon EC2 (NET410) - AWS re:Invent 2018 (20)

Mastering Kubernetes on AWS (CON301-R1) - AWS re:Invent 2018
Mastering Kubernetes on AWS (CON301-R1) - AWS re:Invent 2018Mastering Kubernetes on AWS (CON301-R1) - AWS re:Invent 2018
Mastering Kubernetes on AWS (CON301-R1) - AWS re:Invent 2018
 
Expert Tips for Successful Kubernetes Deployment on AWS
Expert Tips for Successful Kubernetes Deployment on AWSExpert Tips for Successful Kubernetes Deployment on AWS
Expert Tips for Successful Kubernetes Deployment on AWS
 
Expert Tips for Successful Kubernetes Deployment - AWS Summit Sydney 2018
Expert Tips for Successful Kubernetes Deployment - AWS Summit Sydney 2018Expert Tips for Successful Kubernetes Deployment - AWS Summit Sydney 2018
Expert Tips for Successful Kubernetes Deployment - AWS Summit Sydney 2018
 
CON411-R - Advanced network resource management on Amazon EKS
CON411-R - Advanced network resource management on Amazon EKSCON411-R - Advanced network resource management on Amazon EKS
CON411-R - Advanced network resource management on Amazon EKS
 
Run Kubernetes with Amazon EKS - SRV318 - Chicago AWS Summit
Run Kubernetes with Amazon EKS - SRV318 - Chicago AWS SummitRun Kubernetes with Amazon EKS - SRV318 - Chicago AWS Summit
Run Kubernetes with Amazon EKS - SRV318 - Chicago AWS Summit
 
Deep Dive into Amazon Fargate
Deep Dive into Amazon FargateDeep Dive into Amazon Fargate
Deep Dive into Amazon Fargate
 
Kubernetes Networking in Amazon EKS (CON412) - AWS re:Invent 2018
Kubernetes Networking in Amazon EKS (CON412) - AWS re:Invent 2018Kubernetes Networking in Amazon EKS (CON412) - AWS re:Invent 2018
Kubernetes Networking in Amazon EKS (CON412) - AWS re:Invent 2018
 
SRV314 Containerized App Development with AWS Fargate
SRV314 Containerized App Development with AWS FargateSRV314 Containerized App Development with AWS Fargate
SRV314 Containerized App Development with AWS Fargate
 
使用 AWS EKS 打造高效原生雲端 (Cloud Native ) 設計 (Level 400)
使用 AWS EKS 打造高效原生雲端 (Cloud Native ) 設計 (Level 400)使用 AWS EKS 打造高效原生雲端 (Cloud Native ) 設計 (Level 400)
使用 AWS EKS 打造高效原生雲端 (Cloud Native ) 設計 (Level 400)
 
SRV318 Running Kubernetes with Amazon EKS
SRV318 Running Kubernetes with Amazon EKSSRV318 Running Kubernetes with Amazon EKS
SRV318 Running Kubernetes with Amazon EKS
 
Introducing AWS Fargate
Introducing AWS FargateIntroducing AWS Fargate
Introducing AWS Fargate
 
Introducing AWS Fargate - AWS Online Tech Talks
Introducing AWS Fargate - AWS Online Tech TalksIntroducing AWS Fargate - AWS Online Tech Talks
Introducing AWS Fargate - AWS Online Tech Talks
 
Getting Started with Kubernetes on AWS
Getting Started with Kubernetes on AWSGetting Started with Kubernetes on AWS
Getting Started with Kubernetes on AWS
 
具備高可用性和可擴展性的 Kubernetes 服務 (Amazon EKS)
具備高可用性和可擴展性的 Kubernetes 服務 (Amazon EKS)具備高可用性和可擴展性的 Kubernetes 服務 (Amazon EKS)
具備高可用性和可擴展性的 Kubernetes 服務 (Amazon EKS)
 
Expert Tips for Successful Kubernetes Deployments on AWS
Expert Tips for Successful Kubernetes Deployments on AWSExpert Tips for Successful Kubernetes Deployments on AWS
Expert Tips for Successful Kubernetes Deployments on AWS
 
Containerizing Legacy .NET Workloads (CON348-R1) - AWS re:Invent 2018
Containerizing Legacy .NET Workloads (CON348-R1) - AWS re:Invent 2018Containerizing Legacy .NET Workloads (CON348-R1) - AWS re:Invent 2018
Containerizing Legacy .NET Workloads (CON348-R1) - AWS re:Invent 2018
 
[AWS Container Service] Introducing AWS Fargate
[AWS Container Service] Introducing AWS Fargate[AWS Container Service] Introducing AWS Fargate
[AWS Container Service] Introducing AWS Fargate
 
Deep Dive on Amazon Elastic Container Service (ECS) I AWS Dev Day 2018
Deep Dive on Amazon Elastic Container Service (ECS) I AWS Dev Day 2018Deep Dive on Amazon Elastic Container Service (ECS) I AWS Dev Day 2018
Deep Dive on Amazon Elastic Container Service (ECS) I AWS Dev Day 2018
 
使用 Amazon EKS 打造高效的服務架構設計
使用 Amazon EKS 打造高效的服務架構設計使用 Amazon EKS 打造高效的服務架構設計
使用 Amazon EKS 打造高效的服務架構設計
 
Builders' Day- Mastering Kubernetes on AWS
Builders' Day- Mastering Kubernetes on AWSBuilders' Day- Mastering Kubernetes on AWS
Builders' Day- Mastering Kubernetes on AWS
 

Plus de Amazon Web Services

Tools for building your MVP on AWS
Tools for building your MVP on AWSTools for building your MVP on AWS
Tools for building your MVP on AWS
Amazon Web Services
 
How to Build a Winning Pitch Deck
How to Build a Winning Pitch DeckHow to Build a Winning Pitch Deck
How to Build a Winning Pitch Deck
Amazon Web Services
 
Building a web application without servers
Building a web application without serversBuilding a web application without servers
Building a web application without servers
Amazon Web Services
 
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
Amazon Web Services
 

Plus de Amazon Web Services (20)

Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
 
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
 
Esegui pod serverless con Amazon EKS e AWS Fargate
Esegui pod serverless con Amazon EKS e AWS FargateEsegui pod serverless con Amazon EKS e AWS Fargate
Esegui pod serverless con Amazon EKS e AWS Fargate
 
Costruire Applicazioni Moderne con AWS
Costruire Applicazioni Moderne con AWSCostruire Applicazioni Moderne con AWS
Costruire Applicazioni Moderne con AWS
 
Come spendere fino al 90% in meno con i container e le istanze spot
Come spendere fino al 90% in meno con i container e le istanze spot Come spendere fino al 90% in meno con i container e le istanze spot
Come spendere fino al 90% in meno con i container e le istanze spot
 
Open banking as a service
Open banking as a serviceOpen banking as a service
Open banking as a service
 
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
 
OpsWorks Configuration Management: automatizza la gestione e i deployment del...
OpsWorks Configuration Management: automatizza la gestione e i deployment del...OpsWorks Configuration Management: automatizza la gestione e i deployment del...
OpsWorks Configuration Management: automatizza la gestione e i deployment del...
 
Microsoft Active Directory su AWS per supportare i tuoi Windows Workloads
Microsoft Active Directory su AWS per supportare i tuoi Windows WorkloadsMicrosoft Active Directory su AWS per supportare i tuoi Windows Workloads
Microsoft Active Directory su AWS per supportare i tuoi Windows Workloads
 
Computer Vision con AWS
Computer Vision con AWSComputer Vision con AWS
Computer Vision con AWS
 
Database Oracle e VMware Cloud on AWS i miti da sfatare
Database Oracle e VMware Cloud on AWS i miti da sfatareDatabase Oracle e VMware Cloud on AWS i miti da sfatare
Database Oracle e VMware Cloud on AWS i miti da sfatare
 
Crea la tua prima serverless ledger-based app con QLDB e NodeJS
Crea la tua prima serverless ledger-based app con QLDB e NodeJSCrea la tua prima serverless ledger-based app con QLDB e NodeJS
Crea la tua prima serverless ledger-based app con QLDB e NodeJS
 
API moderne real-time per applicazioni mobili e web
API moderne real-time per applicazioni mobili e webAPI moderne real-time per applicazioni mobili e web
API moderne real-time per applicazioni mobili e web
 
Database Oracle e VMware Cloud™ on AWS: i miti da sfatare
Database Oracle e VMware Cloud™ on AWS: i miti da sfatareDatabase Oracle e VMware Cloud™ on AWS: i miti da sfatare
Database Oracle e VMware Cloud™ on AWS: i miti da sfatare
 
Tools for building your MVP on AWS
Tools for building your MVP on AWSTools for building your MVP on AWS
Tools for building your MVP on AWS
 
How to Build a Winning Pitch Deck
How to Build a Winning Pitch DeckHow to Build a Winning Pitch Deck
How to Build a Winning Pitch Deck
 
Building a web application without servers
Building a web application without serversBuilding a web application without servers
Building a web application without servers
 
Fundraising Essentials
Fundraising EssentialsFundraising Essentials
Fundraising Essentials
 
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
 
Introduzione a Amazon Elastic Container Service
Introduzione a Amazon Elastic Container ServiceIntroduzione a Amazon Elastic Container Service
Introduzione a Amazon Elastic Container Service
 

Deep Dive on Container Networking at Scale on Amazon EKS, Amazon ECS, & Amazon EC2 (NET410) - AWS re:Invent 2018

  • 1.
  • 2. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Workshop: Deep Dive on Container Networking at Scale on Amazon EKS, Amazon ECS, & Amazon EC2 N E T 4 1 0 Liwen Wu Software Development Engineer Amazon Web Services Ikenna Izugbokwe Sr. Solutions Architect Amazon Web Services Pratik Mankad Partner Solutions Architect Amazon Web Services
  • 3. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Agenda • Workshop environment • ECS networking • Kubernetes: • Key concepts and architecture • Networking requirements • Networking implementation • Amazon EKS: • EC2 and VPC considerations • CNI details • Kubernetes on EC2: Kops • Workshop activity: Amazon EKS & Kubernetes on EC2 (Kops)
  • 4. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Workshop Environment Setup… • Launch CloudFormation template: • GitHub: https://github.com/liwenwu -amazon/reinvent2018-NET410 • CloudFormation template creates: • Two Amazon EC2 instances (workshop instances) • Sets up environment • Two kubernetes clusters: 1. Kops Cluster 2. EKS Cluster • Two EC2 instances for workshop activities: • net410-workshop-kops-mgmt • net410-workshop-eks-mgmt
  • 5. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
  • 6. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Deployment Options Amazon EC2 Kubernetes +
  • 7. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
  • 8. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. ECS networkMode: none EC2 Task 1 lo eth0 10.1.1.11 127.0.0.1 • Disables all networking • IP for the container not configured • No access to the external network as well as for other containers. • Has the loopback address. docker0: 172.17.0.1/16
  • 9. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. ECS networkMode: host EC2 Task 1 lo eth0 10.1.1.11 127.0.0.1 • Shares the host’s network stack • All interfaces from the host will be available to the container • Host name will match the host name on the host system • No network isolation eth0 docker0 10.1.1.11 172.17.0.1 docker0: 172.17.0.1/16
  • 10. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. ECS networkMode: bridge EC2 Task 1 eth0 docker0: 172.17.0.1/16eth0 10.1.1.11 172.17.0.2:1234 • Uses software bridge: docker0 • Containers are attached to docker bridge • Own IP address and all TCP ports are available • No network isolation between containers vethxx Task 2 eth0 172.17.0.3:4567 vethxx
  • 11. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. ECS networkMode: bridge • Container on across EC2 instances… EC2-1 EC2-2 docker0: 172.17.0.1/16 eth0 10.1.1.11 vethxx eth0 172.17.0.2:1234 docker0: 172.17.0.1/16 eth0 10.1.2.11 vethxx eth0 172.17.0.2:4567 Router Task 1 Task 1
  • 12. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. ECS networkMode: awsvpc EC2 • Each task has it’s own elastic network interface • Achieves network isolation • Security group on the primary and task ENI • Container gets its own addressable IP ecs-bridge: 169.254.172.1/30 eth0 10.1.1.11 vethxx ecs-eth0 169.254.172.2/30 Task 1 eth1 10.1.1.12
  • 13. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. ECS networkMode: awsvpc EC2-1 10.1.1.12:1234 eth0 eth1 10.1.1.11 EC2-2 10.1.2.12:1234 eth0 eth1 10.1.2.11
  • 14. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
  • 15. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Key Kubernetes concepts: • Kubernetes Control Plane • Provided by Master Node Objects/processes • Kubernetes Data Plane • Provided by Worker Nodes Objects/processes • Kubernetes Master Node • Kube-apiserver • Kube-controller-manager • Kube-scheduler • Kubernetes Worker Nodes • Kubelet • Kube-proxy • Pods
  • 16. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Kubernetes Master Node
  • 17. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Kubernetes Worker Node
  • 18. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Kubernetes objects and examples • Represent the state of the cluster • They are records of “intent” or cluster desired state. • Acted upon by calling k8s API directly from client libraries or via cli – kubectl • Identified by a name and a UID • Labels • Key/value pair attached to objects. Used by service to define sets of pods (key use case). • Annotations • Control load balancer configuration in EKS.
  • 19. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Kubernetes architecture: Cloud
  • 20. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
  • 21. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Four networking problems: • Container-to-container communications • Pod-to-pod communications • Pod-to-service communications • External-to-internal communications
  • 22. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. What is a pod ... • Smallest and simplest computing unit • Group of one or more containers • Co-located and co-scheduled • Share a network stack and storage • Containers within a pod share an IP address
  • 23. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. From Kubernetes perspective … • Pods can communicate with other pods • Every pod gets its own IP address • Mapping container ports to node (host) port not required
  • 24. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
  • 25. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Kubernetes CNI’s (plugins) • Kubenet (default for kops) • Utilizes VPC route table for pod -to-pod traffic between nodes • Calico • Uses BGP to distribute routes • Weave • All nodes in cluster share same subnet—single L2 broadcast domain • Flannel • Leverages VXLAN overlay network • Amazon-vpc-cni-k8s • Amazon routed ENI VPC CNI
  • 26. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
  • 27. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. EC2 and VPC considerations—EKS • AWS EC2 instance type: • Determine the maximum number of Elastic Network Interfaces ( ENI) • Determine the number of IP addresses • Larger instances support more IP addresses: • c5d.18xlarge supports 15 ENIs and each ENI can support up -to 50 IPv4 addresses • EKS requires subnets in at least two AZ’s • Use separate VPC for each EKS cluster • Warm pool of IP addresses
  • 28. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
  • 29. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. amazon-vpc-cni-k8s Container Networking Interface (CNI) Tenets: • Integrates Amazon Virtual Private Cloud networking into Kubernetes • Should use Amazon VPC networking natively to forward pod-to-pod traffic • Use AWS routable IP addresses for Pods • Pods is 1st class citizen in Amazon VPC networking • There is NO on-ramp/off-ramp for • Pod to AWS services (e.g. Amazon S3, Amazon DynamoDB) communication • Pod to on-premises communication (e.g. VPN/direct -connect) • Should make sure pods have fast startup time: • Pods/Containers MUST be able to send and receive traffic in the matter of seconds (compare to minutes for VM)
  • 30. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. CNI networking details—Data plane VPC network EC2 POD L3 routing POD L3 routing POD POD L3 routing POD ENI ENI ENI
  • 31. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Life of a packet: pod1-to-pod2, inside node EC2 Pod1 eth0 Pod2 eth0 ENI root veth-pod1 veth-pod2
  • 32. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Life of a packet: pod1-to-pod2, inside node EC2 Pod1 eth0 Pod2 eth0 ENI root veth-pod1 veth-pod2
  • 33. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Life of a packet: pod1-to-pod2, inside node EC2 Pod1 eth0 Pod2 eth0 ENI root veth-pod1 veth-pod2
  • 34. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Life of a packet: pod1-to-pod2, inside node EC2 Pod1 eth0 Pod2 eth0 ENI root veth-pod1 veth-pod2
  • 35. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Life of a packet: pod1-to-pod2, inside node EC2 Pod1 eth0 Pod2 eth0 ENI root veth-pod1 veth-pod2
  • 36. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Life of a packet: pod1-to-pod3, across nodes ENI EC2 node1 Pod1 eth0 Pod2 eth0 root veth-pod1 veth-pod2 EC2 node2 Pod3 eth0 Pod4 eth0 root veth-pod3 veth-pod4
  • 37. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Life of a packet: pod1-to-pod3, across nodes ENI EC2 node1 Pod1 eth0 Pod2 eth0 root veth-pod1 veth-pod2 EC2 node2 Pod3 eth0 Pod4 eth0 root veth-pod3 veth-pod4
  • 38. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Life of a packet: pod1-to-pod3, across nodes ENI EC2 node1 Pod1 eth0 Pod2 eth0 root veth-pod1 veth-pod2 EC2 node2 Pod3 eth0 Pod4 eth0 root veth-pod3 veth-pod4
  • 39. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Life of a packet: pod1-to-pod3, across nodes ENI EC2 node1 Pod1 eth0 Pod2 eth0 root veth-pod1 veth-pod2 EC2 node2 Pod3 eth0 Pod4 eth0 root veth-pod3 veth-pod4
  • 40. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Life of a packet: pod1-to-pod3, across nodes ENI EC2 node1 Pod1 eth0 Pod2 eth0 root veth-pod1 veth-pod2 EC2 node2 Pod3 eth0 Pod4 eth0 root veth-pod3 veth-pod4
  • 41. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Life of a packet: pod1-to-pod3, across nodes ENI EC2 node1 Pod1 eth0 Pod2 eth0 root veth-pod1 veth-pod2 EC2 node2 Pod3 eth0 Pod4 eth0 root veth-pod3 veth-pod4
  • 42. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Life of a packet: pod1-to-pod3, across nodes ENI EC2 node1 Pod1 eth0 Pod2 eth0 root veth-pod1 veth-pod2 EC2 node2 Pod3 eth0 Pod4 eth0 root veth-pod3 veth-pod4
  • 43. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Life of a packet: pod1-to-pod3, across nodes ENI EC2 node1 Pod1 eth0 Pod2 eth0 root veth-pod1 veth-pod2 EC2 node2 Pod3 eth0 Pod4 eth0 root veth-pod3 veth-pod4
  • 44. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Kubernetes Service Service PodPodPod
  • 45. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. For example: Kubernetes Service IP (10.100.0.1) kubectl describe svc Name: kubernetes Namespace: default Labels: component=apiserver provider=kubernetes Annotations: <none> Selector: <none> Type: ClusterIP IP: 10.100.0.1 Port: https 443/TCP TargetPort: 443/TCP Endpoints: 192.168.119.102:443,192.168 .154.135:443 Session Affinity: ClientIP Events: <none>
  • 46. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Kubernetes DNS Pod (kube-dns) • Kubernetes schedules a DNS Pod (kube-dns) and Service on the cluster • Configures the Kubelets to tell individual containers to use the DNS Service’s IP to resolve DNS names • DNS Pod communicate with Kubernetes Service IP (e.g 10.100.0.1) and build map of Service Name and Service IP
  • 47. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Life of a packet: pod (kube-dns)-to-service (Kubernetes service) ENI EC2 node1 Kube-dns eth0 Pod2 eth0 root veth-dns-pod veth-pod2 EKS-Owned ENI 192.168.119.102 EKS-Owned EN 192.168.154.135I Customer VPC EKS VPC 10.100.0.1 APIServer Availability Zone 1 APIServer Availability Zone 2
  • 48. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Life of a packet: pod (kube-dns)-to-service (Kubernetes service) ENI EC2 node1 Kube-dns eth0 Pod2 eth0 root veth-dns-pod veth-pod2 EKS-Owned ENI 192.168.119.102 EKS-Owned EN 192.168.154.135I Customer VPC EKS VPC 10.100.0.1 APIServer Availability Zone 1 APIServer Availability Zone 2
  • 49. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Life of a packet: pod (kube-dns)-to-service (Kubernetes service) ENI EC2 node1 Kube-dns eth0 Pod2 eth0 root veth-dns-pod veth-pod2 EKS-Owned ENI 192.168.119.102 EKS-Owned EN 192.168.154.135I Customer VPC EKS VPC 10.100.0.1 APIServer Availability Zone 1 APIServer Availability Zone 2
  • 50. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Life of a packet: pod (kube-dns)-to-service (Kubernetes service) ENI EC2 node1 Kube-dns eth0 Pod2 eth0 root veth-dns-pod veth-pod2 EKS-Owned ENI 192.168.119.102 EKS-Owned EN 192.168.154.135 Customer VPC EKS VPC APIServer Availability Zone 1 APIServer Availability Zone 2
  • 51. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Life of a packet: pod (kube-dns)-to-service (Kubernetes service) ENI EC2 node1 Kube-dns eth0 Pod2 eth0 root veth-dns-pod veth-pod2 EKS-Owned ENI 192.168.119.102 EKS-Owned EN 192.168.154.135I Customer VPC EKS VPC APIServer Availability Zone 1 APIServer Availability Zone 2
  • 52. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Life of a packet: pod (kube-dns)-to-service (Kubernetes service) ENI EC2 node1 Kube-dns eth0 Pod2 eth0 root veth-dns-pod veth-pod2 EKS-Owned ENI 192.168.119.102 EKS-Owned EN 192.168.154.135I Customer VPC EKS VPC APIServer Availability Zone 1 APIServer Availability Zone 2
  • 53. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Life of a packet: pod (kube-dns)-to-service (Kubernetes service) ENI EC2 node1 Kube-dns eth0 Pod2 eth0 root veth-dns-pod veth-pod2 EKS-Owned ENI 192.168.119.102 EKS-Owned EN 192.168.154.135I Customer VPC EKS VPC APIServer Availability Zone 1 APIServer Availability Zone 2
  • 54. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. CNI networking details—Control plane • Kubelet invokes CNI add or delete commands for pods • CNI request secondary IPs from ipamD and setups networking stack for pod • For fast pods startup time, IP address manager database (ipamD) creates a secondary IP warm pool with one more ENI and its IP address
  • 55. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. CNI Networking details—Control plane EC2
  • 56. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
  • 57. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Networking explained … eth0 eth0 vethxxxx vethxxxx eth0 crb0 EC2
  • 58. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Pod-to-Pod Communications (kops): EC2 Pod 1 eth0 eth0 vethxxxxvethxxxx crb0: 100.65.129.1eth0 10.0.1.11 • Pods on the same instance… Pod 2 100.65.129.11 100.65.129.12
  • 59. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Pod-to-Pod Communications (kops): • Pods across EC2 instances… EC2-1 eth0 10.1.1.11 crb0: 100.65.130.1 eth0Pod 1 vethxxxx 100.65.130.11 EC2-2 eth0 10.1.2.11 crb0: 100.65.129.1 eth0Pod 2 vethxxxx 100.65.129.11 Router (GW) 100.65.129.0/24 via eni: 10.0.1.11 100.65.130.0/24 via eni: 10.0.1.12
  • 60. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Pod-to-Service Communications (kops): EC2-1 eth0 10.0.1.11 crb0: 100.65.130.1 eth0Pod 1 vethxxxx 100.65.130.11 Router (GW) 100.65.130.0/24 via eni: 10.1.1.11 100.65.129.0/24 via eni: 10.1.2.11 kube-proxy Connect To: 100.65.130.11:8080 iptables: service xx endpoints yy EC2-2 eth0 10.0.1.11 crb0: 100.65.130.1 eth0Pod 2 vethxxxx 100.65.130.11 kube-proxy SERVICE: NAME: service-net410 TYPE: ClusterIP CLUSTER-IP: 100.64.31.116 EXTERNAL-IP: <none> PORTS: 80/TCP
  • 61. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. External-to-internal communications (kops): VPC CIDR: 10.0.0.0/16 eth0 vethxxxx vethxxxx crb0: 100.64.129.1 eth0 Router: 10.0.1.1 eth0: 10.0.1.11 100.64.129.0/24 via eni: 10.0.1.11 100.64.130.0/24 via eni: 10.0.1.12 100,64.129.11 eth0 100,64.129.12 kube-proxy Iptables service xx endpoints yy EC2-2 eth0 vethxxxx vethxxxx crb0: 100.64.129.1 eth0 eth0: 10.0.1.12 100,64.130.11 eth0 100,64.130.12 SERVICE: NAME: service-net410 TYPE: LoadBalancer CLUSTER-IP: 100.64.31.116 EXTERNAL-IP: LB DNS PORTS: 80:31787/TCP kube-proxy Iptables service xx endpoints yy EC2-1 Internet EC2-1 EC2-2 ELB DNS: a266xxyy.us-west-2.elb.amazonaws.com
  • 62. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. NET410 workshop activity • To begin workshop activity: • Access https://github.com/liwenwu -amazon/reinvent2018-NET410
  • 63. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. References: • https://kubernetes.io/ • https://kubernetes.io/docs/concepts/cluster- administration/networking/ • https://kubernetes.io/docs/concepts/services-networking/service/ • https://aws.amazon.com/blogs/compute/kubernetes-clusters-aws- kops/ • https://github.com/aws/amazon-vpc-cni-k8s
  • 64. Thank you! © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Ikenna Izugbokwe Sr. Solutions Architect Amazon Web Services Liwen Wu Software Development Engineer Amazon Web Services Pratik Mankad Partner Solutions Architect Amazon Web Services
  • 65. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.