--- title: "EKS Custom Networking" type: concept tags: - AWS - EKS - Kubernetes - Networking - VPC - IPAM sources: - ctp-topic-39-implementing-eks-in-the-aws-lab-landing-zone last_updated: 2026-04-28 --- ## Overview EKS Custom Networking 是 AWS EKS 提供的一项功能,允许用户绕过默认的 VPC CNI(Amazon VPC CNI plugin for Kubernetes)行为,自定义 Pod 的网络 IP 分配策略。这在 IP 地址受限或需要特殊网络配置的环境中尤为重要。 ## Definition EKS 自定义网络(Custom Networking)通过以下机制实现: - 通过 EKS 模块的自定义网络配置标志(flag)启用 - 支持指定自定义的弹性网络接口(ENI)配置 - 允许 Pod 使用独立于默认 VPC 子网的 IP 地址池 ## Use Case: AWS Lab Landing Zone 在 AWS Lab Landing Zone 环境中,Micro Focus 网络的 IP 地址池有限,无法满足 EKS 集群中大量 Pod 的 IP 分配需求。通过自定义网络配置: 1. 在独立私有子网(非主 VPC 子网)创建 EKS 集群 2. 启用 EKS 模块的自定义网络标志 3. EKS 使用指定的子网和 IP 范围分配 Pod 地址 ## Core Mechanism ``` EKS Module (Terraform) └── custom_networking_enabled = true ├── subnet_ids = [custom_subnet_ids] └── additional_eni_config = ... ``` ## Key Benefits - **突破 VPC CIDR 限制**:在受限网络环境中仍可部署大规模 Pod - **IP 地址灵活性**:使用专用 IP 池,无需消耗 VPC 主网络地址 - **网络隔离**:独立子网提供额外的网络安全边界 ## Limitations - 需要 Terraform/Terragrunt 模块支持自定义网络标志 - Atlantis 当前不支持 EKS 集群部署(需使用 Jenkins + Terragrunt) - 容器安全加固需额外考虑网络隔离 ## Related Concepts - [[Amazon-EKS]]:应用自定义网络技术的容器编排平台 - [[Host-Network-Mode]]:Pod 规范层面的网络模式配置 - [[EMI-Elastic-Network-Interface]]:ENI 多 IP 分配(EMI)在 EKS 中的应用 - [[IPAM]]:IP 地址管理,与自定义网络协同 ## Related Sources - [[ctp-topic-39-implementing-eks-in-the-aws-lab-landing-zone]]