Demystifying AWS EKS CNI end to end
Soumyadip Chatterjee
??? DevOps Engineer |Istio ?? | Terraform ???, |Docker ?? | K8's??| Snowflake ?? | Argo CD?? | Helm ?? | GitLab ?? | Ansible ?? | Certifications:- 2x AWS ??, 1x Azure???, 1x OCI??, 1x Commvault
Today we will cover one of the most important topic in EKS networking as CNI (Container Network Interface) . So let's start from scratch .
What is CNI ?
The copy book definition illustrates as the AWS VPC CNI plugin, which is the default networking plugin for EKS, integrates deeply with Amazon VPC to leverage AWS networking features and also ensure the robustness ,scalable & seamless networking for Kubernetes pods .
Key Components in CNI :-
Elastic Network Interfaces (ENIs):
Please note that there is a limitation of ENI associate with EC2 instance based on its type . Follow the below table illustrates the same .
The IP address sourced from VPC subnets CIDR block on where the nodes associated with . This integration ensures that those pods associate with nodes can route traffic within the VPC .
Prefix Delegation (Optional):
Allows the allocation of larger prefixes to ENIs, which can then be subdivided into individual IP addresses for pods. This enhances IP address utilization and increases the maximum number of pods per node.
How CNI Architecture Works in EKS
Benefits of CNI Architecture :-
Scalability:
Integration with AWS Services:
Pods can interact with other AWS services (S3,DynamoDB , RDS) using the VPC network and connected with VPC with the assist from NACL & Security group .
Performance:
Security groups and NACLs provide fine-grained control over the traffic to and from pods, ensuring a secure network environment.
The VPC CNI plugin abstracts the complexity of networking, making it easier to manage and deploy Kubernetes clusters on AWS.
What is Prefix Delegation ?
With prefix delegation enabled, you can allocate larger CIDR blocks to ENIs, effectively increasing the number of IP addresses (and thus pods) that can be assigned per node. For example, if you allocate a /28 prefix to each ENI, you can significantly increase the IP address capacity beyond the default limits.
Now simplify the entire concept by examples and diagrams :-
Let’s consider an m5.large instance:
This means an m5.large instance can host up to 30 pods (each requiring one IP address).
With Prefix Delegation
With prefix delegation, instead of assigning individual IP addresses to each pod, a larger prefix (subnet) is allocated to each ENI, and the CNI plugin then assigns IP addresses from this prefix to the pods. This can increase the number of IP addresses (and thus pods) that can be assigned per ENI.
Example Setup
Let’s assume the following:
Calculations
Without Prefix Delegation
An m5.large instance can host up to 30 pods.
With Prefix Delegation :-
Therefore additional 12 pods the nodes can be scheduled and it ensures the proper scalability of nodes and pods on where the scenario comes of Pod density in nodes .
Conclusion :-
AWS CNI plugin ensures to establish seamless networking policies which enhances robust and scalable networking solution increases efficiency & performance towards EKS cluster .
Senior Consultant at Capgemini | Cybersecurity enthusiastic |CEH |DevSecOps|Cloud Security| Kubernetes|Docker|Terraform| AWS
1 个月great article ??
Busy Simplifying DevOps | Content Creator | Principal Engineer at Red Hat | OpenSource Enthusiast
1 个月Insightful!