k8s hostport
spec:
containers:
- image: nginx
name: nginx
ports:
- containerPort: 80
hostPort: 8080
iptables增加dnat规则,完成主机端口8080到容器端口80的映射。
优点:固定转发到本节点pod。
缺点:占用节点端口。
spec:
containers:
- image: nginx
name: nginx
ports:
- containerPort: 80
hostPort: 8080
iptables增加dnat规则,完成主机端口8080到容器端口80的映射。
优点:固定转发到本节点pod。
缺点:占用节点端口。