问题原文
原帖链接 · Ruben Ernst · CC BY-SA 3.0
Currently I'm working on a small hobby project which I'll make open source once it's ready. This service is running on Google Container Engine. I chose GCE to avoid configuration hassle, the costs are affordable and to learn new stuff.
My pods are running fine and I created a service with type LoadBalancer to expose the service on port 80 and 443. This works perfectly.
However, I discovered that for each LoadBalancer service, a new Google Compute Engine load balancer is created. This load balancer pretty expensive and really over done for a hobby project on a single instance.
To cut the costs I'm looking for a way to expose the ports without the load balancer.
What i've tried so far:
Deploy a
NodePortservice. Unfortunately it's disallowed to expose a port below 30000.Deploy an Ingress but this also creates a load balancer.
Tried to disable
HttpLoadBalancing(https://cloud.google.com/container-engine/reference/rest/v1/projects.zones.clusters#HttpLoadBalancing) but it still creates a load balancer.
Is there a way to expose port 80 and 443 for a single instance on Google Container Engine without a load balancer?
已采纳解答
原帖链接 · ConnorJC · CC BY-SA 3.0
Yep, through externalIPs on the service. Example service I've used:
apiVersion: v1
kind: Service
metadata:
name: bind
labels:
app: bind
version: 3.0.0
spec:
ports:
- port: 53
protocol: UDP
selector:
app: bind
version: 3.0.0
externalIPs:
- a.b.c.d
- a.b.c.e
Please be aware that the IPs listed in the config file must be the internal IP on GCE.
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
