Kubernetes - can I avoid using the GCE Load Balancer to reduce cost?
Solution 1:
Yes, via ExternalIPs. Be aware that this will mean your service will go down if the node that has said external IP assigned fails, but if you're only running 1 master you probably don't care much about that.
Example service:
apiVersion: v1
kind: Service
metadata:
name: myapp
spec:
ports:
- port: 80
protocol: TCP
selector:
app: myapp
externalIPs:
- a.b.c.d
The IP need to be the internal IP of the GCE instance (This is because GCE DNATs the traffic to the internal IPs). The service should then be accessible via the node's assigned external IP.
You will probably want to change the service for your ingress controller, so that you can route all of your apps through one IP.
Solution 2:
I prefer not to use the cloud load balancers, until necessary, because of cost and vendor lock-in.
Instead I use this: https://kubernetes.github.io/ingress-nginx/deploy/
It's a pod that runs a load balancer for you. That page has GKE specific installation notes.