k8s主机暴露端口

原文:https://zhuanlan.zhihu.com/p/589599203?utm_id=0

此外我们还可以将 Node 的端口映射到宿主机,通过配置文件中的 extraPortMappings 属性可以实现该功能,如下所示配置可以将 control-plane 节点 80 端口映射到宿主机的 80 端口上:

kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
 - role: control-plane
   extraPortMappings:
     - containerPort: 80
       hostPort: 80
       listenAddress: "0.0.0.0" # Optional, defaults to "0.0.0.0"
       protocol: udp # Optional, defaults to tcp
posted @ 2023-09-28 11:27  MaxBruce  阅读(101)  评论(0)    收藏  举报