Files
nexus/wiki/sources/ctp-topic-70-eks-deployment-using-iac.md

82 lines
5.6 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
title: "CTP Topic 70 EKS deployment using IAC"
type: source
tags:
- AWS
- EKS
- IaC
- Kubernetes
- CTP
last_updated: 2026-04-28
---
## Source File
- [[Cloud & DevOps/Public-Cloud-Learning-Sessions/04_EKS/ctp-topic-70-eks-deployment-using-iac.md]]
## Summary用中文描述
- 核心主题通过基础设施即代码IaC部署 Amazon EKS 集群涵盖容器与虚拟机对比、EKS 特性、Terraform/Service Catalog 两种部署方式、自定义网络与自动扩缩容、以及监控体系。
- 问题域:企业如何在 AWS 云中使用 IaC 工具标准化、可重复地部署和管理 Kubernetes 集群。
- 方法/机制:
- **Terraform 部署**:通过 `tera-grant.scl` 文件定义环境变量、EKS 版本和工作节点类型CPU/GPU/default集成 AWS Secrets Manager 发送通知。
- **Service Catalog 部署**:提供版本选择和工作节点类型配置,对安全与权限有更多控制。
- **自定义网络EMI**:为 Pod 分配弹性网络接口以解决 CIDR 限制。
- **集群自动扩缩容**Kubernetes Cluster Autoscaler 根据资源需求自动扩缩工作节点。
- **监控体系**CloudWatch Agent + FluentBitDaemonSet+ Container Insights + Grafana 集中可视化。
- 结论/价值SRE EKS 模块提供企业级 Kubernetes 部署方案,通过 IaC 实现标准化,通过 ALB Ingress Controller 实现流量管理,通过自定义 EMI 解决网络限制,通过集中监控实现主动告警。
## Key Claims用中文描述
- 容器相比虚拟机:启动时间更短、内存效率更高、更易于跨环境迁移。
- Kubernetes 提供分布式系统运行框架,具备零停机滚动部署、负载均衡和水平 Pod 扩缩容能力。
- EKS 提供完全托管的控制平面和工作节点自动扩缩,支持零停机滚动更新和 IAM RBAC 最小权限映射。
- SRE EKS 模块通过 Terraform 或 Service Catalog 两种方式部署Service Catalog 提供更细粒度的安全控制。
- 自定义 EMI 网络为 Pod 分配 IP 地址,解决 VPC CIDR 限制问题。
- Kubernetes Cluster Autoscaler 自动根据资源需求扩缩工作节点。
- 监控方案CloudWatch Agent + FluentBitDaemonSet+ Container Insights 发布指标至 CloudWatch配合集中式 Grafana 仪表板可视化。
## Key Quotes
> "EKS, a managed Kubernetes service by Amazon, offers features like fully managed control planes and autoscaling worker nodes." — EKS 托管服务核心价值
> "Zero downtime rolling deployments for worker node updates and IAM RBAC mapping for least privilege access are implemented." — SRE EKS 模块核心安全实践
> "Service Catalog allows creating, organizing, and governing AWS resources with permission control." — Service Catalog 在 EKS 部署中的角色
> "Custom networking for pods addresses CIDR limitations by adding a virtual EMI to assign IP addresses to pods." — EMI 自定义网络机制
> "Monitoring is achieved using CloudWatch agent and FluentBit deployed as daemon sets." — EKS 监控架构
## Key Concepts
- [[Container]]:轻量级虚拟化技术,相比虚拟机具有更快的启动速度、更高的内存效率和更好的可移植性。
- [[Kubernetes]]:分布式系统运行框架,提供自动化部署、扩缩容、负载均衡和滚动更新能力。
- [[Amazon-EKS]]AWS 托管的 Kubernetes 服务,提供完全托管的控制平面和工作节点自动扩缩。
- [[Infrastructure-as-Code-IaC]]:通过声明式配置管理云基础设施,实现标准化、可重复的部署流程。
- [[Terraform]]HashiCorp 出品的云无关 IaC 工具,用于定义和部署 EKS 集群。
- [[AWS-Service-Catalog]]AWS 服务目录,允许用户通过预定义产品创建 EKS 集群,具备权限控制能力。
- [[ALB-Ingress-Controller]]AWS 负载均衡器入口控制器,用于 EKS 集群的流量管理。
- [[EMI-Elastic-Network-Interface]]:弹性网络接口,用于为 EKS Pod 分配 IP 地址以解决 VPC CIDR 限制。
- [[Cluster-Autoscaler]]Kubernetes 组件,根据资源需求自动扩缩工作节点。
- [[Karpenter]]AWS 开源的 Kubernetes 节点自动配置工具,基于 Pod 需求动态创建最佳实例类型(未来替代 Cluster Autoscaler 的方案)。
- [[CloudWatch-Agent]]AWS 监控代理,用于收集 EKS 集群和容器的日志与指标。
- [[FluentBit]]:开源日志处理器,作为 DaemonSet 部署在每个节点上收集容器日志。
- [[Container-Insights]]EKS 监控功能,发布容器指标至 CloudWatch。
- [[AWS-Open-Telemetry]]:可观测性框架,可用于 EKS 监控数据采集。
- [[Grafana]]:开源可视化平台,通过模板化仪表板展示 EKS 集群和容器指标。
## Key Entities
- [[AWS]]Amazon Web Services提供 EKS 托管 Kubernetes 服务。
- [[HashiCorp]]Terraform 开发商,提供云无关 IaC 工具。
- [[SRE]]Site Reliability Engineering 团队,负责 EKS 模块的设计和维护。
## Connections
- [[Amazon-EKS]] ← uses ← [[Infrastructure-as-Code-IaC]]
- [[Amazon-EKS]] ← deployed_by ← [[Terraform]]
- [[Amazon-EKS]] ← deployed_by ← [[AWS-Service-Catalog]]
- [[Amazon-EKS]] ← manages_traffic_with ← [[ALB-Ingress-Controller]]
- [[Amazon-EKS]] ← networking_extended_by ← [[EMI-Elastic-Network-Interface]]
- [[Amazon-EKS]] ← scales_with ← [[Cluster-Autoscaler]]
- [[Amazon-EKS]] ← monitors_with ← [[CloudWatch-Agent]] + [[FluentBit]] + [[Container-Insights]]
- [[Grafana]] ← visualizes ← [[Amazon-EKS]] monitoring data
- [[Amazon-EKS]] ← extends ← [[Kubernetes]]
## Contradictions
- (本主题未发现与其他 Wiki 页面的直接冲突,与相关 EKS 主题形成互补关系)