mirror of
https://github.com/yeasy/docker_practice.git
synced 2026-03-26 03:35:31 +00:00
Add blank lines around headers
This commit is contained in:
@@ -29,6 +29,7 @@ veth 对
|
||||
↓
|
||||
容器 B (192.168.0.3,不同宿主机)
|
||||
```
|
||||
|
||||
#### 创建和使用 Overlay 网络
|
||||
|
||||
**Docker Swarm 模式下的 Overlay 网络:**
|
||||
@@ -73,6 +74,7 @@ docker exec container1 curl http://container2
|
||||
# 检查网络配置
|
||||
docker network inspect custom-overlay
|
||||
```
|
||||
|
||||
#### Overlay 网络性能优化
|
||||
|
||||
```bash
|
||||
@@ -107,6 +109,7 @@ networks:
|
||||
driver_opts:
|
||||
com.docker.network.driver.mtu: 1450
|
||||
```
|
||||
|
||||
### 9.7.2 CNI 插件生态概览
|
||||
|
||||
容器网络接口(CNI)是容器编排平台(尤其是 Kubernetes)的标准化网络接口。不同的 CNI 插件提供不同的网络能力。
|
||||
@@ -255,6 +258,7 @@ Docker 内嵌 DNS 服务器 (127.0.0.11)
|
||||
↓
|
||||
DNS 响应 → 容器缓存 → 应用
|
||||
```
|
||||
|
||||
#### 配置容器 DNS
|
||||
|
||||
**在运行时指定 DNS:**
|
||||
@@ -317,6 +321,7 @@ networks:
|
||||
"registry-mirrors": ["https://mirror.example.com"]
|
||||
}
|
||||
```
|
||||
|
||||
#### 自定义服务发现
|
||||
|
||||
**使用 Docker 内建 DNS 的服务发现:**
|
||||
@@ -361,6 +366,7 @@ services:
|
||||
# frontend 容器可以直接访问 http://backend:8080
|
||||
# backend 容器可以直接访问 postgres://database:5432
|
||||
```
|
||||
|
||||
#### DNS 性能优化
|
||||
|
||||
```bash
|
||||
@@ -393,6 +399,7 @@ kubectl patch deployment -n kube-system coredns --patch '{
|
||||
}
|
||||
}'
|
||||
```
|
||||
|
||||
### 9.7.4 网络策略实践
|
||||
|
||||
网络策略定义了容器间的流量控制规则,是微服务架构中的安全基础。
|
||||
@@ -473,6 +480,7 @@ spec:
|
||||
- protocol: TCP
|
||||
port: 443
|
||||
```
|
||||
|
||||
#### 微服务网络策略示例
|
||||
|
||||
```yaml
|
||||
@@ -597,6 +605,7 @@ spec:
|
||||
- protocol: TCP
|
||||
port: 5432
|
||||
```
|
||||
|
||||
#### 使用 Calico/Cilium 的高级网络策略
|
||||
|
||||
**L7 应用层策略(仅 Cilium 支持):**
|
||||
@@ -630,6 +639,7 @@ spec:
|
||||
sourceIPs:
|
||||
- "10.0.0.0/8"
|
||||
```
|
||||
|
||||
### 9.7.5 跨主机容器通信方案对比
|
||||
|
||||
#### 方案对比表
|
||||
@@ -661,6 +671,7 @@ helm install cilium cilium/cilium --namespace kube-system
|
||||
|
||||
# 5. 需要多云/跨域:使用 Weave
|
||||
```
|
||||
|
||||
### 9.7.6 网络故障排查
|
||||
|
||||
**常见网络问题诊断:**
|
||||
|
||||
Reference in New Issue
Block a user