GCE: How do you create a forwarding rule from port 80 external to port 5555 internal

后端 未结 2 1400
佛祖请我去吃肉
佛祖请我去吃肉 2021-02-03 12:36

Im using google compute engine for the first time. I would like to set up a network loadbalancer (with static ip) that listens on port 80, but forwards to a backend server lis

2条回答
  •  余生分开走
    2021-02-03 12:50

    Currently, port forwarding is not a GCE load balancer (LBs) feature: LBs forward new incoming requests to target pools (TPs), which distribute among its instances. No IP or port mapping is performed, as only the incoming request is forwarded. LBs expose the ports as they are. So, for multiple ports, you can define a port range, or one different LB for each one.

    To achieve something like this, you can use a port forwarding setup with HAProxy, NAT at instance level with IPTables, or redirect clients from port 80 to port 5555 at software level.

    With Kubernetes, you can achieve port forwarding easily by using services. Services define a proxy that will do all the necessary iptables magic for port forwarding automatically. Hope this helps.

提交回复
热议问题