Auto-sync: update nexus workspace

This commit is contained in:
2026-04-29 07:09:24 +08:00
parent 15cd44b2ca
commit 070bd42886
36 changed files with 1602 additions and 221 deletions

View File

@@ -0,0 +1,50 @@
---
title: "Host Network Mode"
type: concept
tags:
- Kubernetes
- Networking
- Pod-Networking
- AWS
- EKS
sources:
- ctp-topic-39-implementing-eks-in-the-aws-lab-landing-zone
last_updated: 2026-04-28
---
## Overview
Host Network Mode 是 Kubernetes Pod 规范中的一种网络配置选项(`hostNetwork: true`),使 Pod 共享宿主机的网络命名空间,直接使用宿主机的网络接口和 IP 地址,而不是通过 Kubernetes 的虚拟网络。
## Definition
在 Pod spec 中设置 `hostNetwork: true`Pod 将:
- 使用宿主机的网络命名空间
- 直接获得宿主机网络接口上的 IP 地址
- 可以绑定宿主机的端口(如 80、443
- 可直接访问宿主机所在网络上的资源
## Use Case: EKS Lab Landing Zone
在 AWS Lab Landing Zone 的 EKS 部署中Octane 等 IP 密集型应用需要大量可用 IP。通过自定义网络模式Pod 无需通过 VPC CNI 分配 IP而是直接使用宿主机网络的 IP 地址,从而绕开 AWS Lab 环境 IP 地址池受限的问题。
```yaml
spec:
hostNetwork: true
containers:
- name: octane
image: octane:latest
```
## Trade-offs
| 优点 | 缺点 |
|------|------|
| 突破 Pod IP 数量限制 | Pod 之间端口冲突风险 |
| 直接访问宿主机网络资源 | 安全性降低Pod 可访问宿主机所有网络) |
| 简化网络路径 | 违反 Kubernetes 网络隔离原则 |
| 适合特殊网络需求场景 | 难以在不同环境中移植 |
## Related Concepts
- [[Amazon-EKS]]:使用 Host Network Mode 的容器编排平台
- [[IPAM]]IP 地址管理,与 Host Network Mode 在 IP 分配上形成互补
- [[Kubernetes-Tagging]]Pod 标记策略
## Related Sources
- [[ctp-topic-39-implementing-eks-in-the-aws-lab-landing-zone]]