k8s hostport

spec:
  containers:
  - image: nginx
    name: nginx
    ports:
    - containerPort: 80
      hostPort: 8080

iptables增加dnat规则,完成主机端口8080到容器端口80的映射。

优点:固定转发到本节点pod。
缺点:占用节点端口。

posted on 2026-03-20 20:30  王景迁  阅读(3)  评论(0)    收藏  举报

导航