I have set up a working web server using google Container Engine. It is a single container running a web service and is accessible from the browser.
The tutorial said to use a load balancer to expose an external IP, which I did.
My question is: Do I have to use a load balancer? or is there another way to get an external IP?
The reason I ask is that the load-balancer looks like it will cost way more than any other part of the set up and I don't actually need to load-balance anything. I used the google pricing calculator to assume this.
You don't HAVE to use a load balancer but your usage of GKE to run one container is not really ideal.
What you could do is use the NodePort type instead of LoadBalancer. That will expose the Node IP addresses with the port of the application that you are running on.
When you use NodePort, it will map a high port range to your port 80 application, for example 31324.
To find out this port, do:
kubectl describe svc wordpress
Find out what the external IP of your GCE machine is and then type this into your browser: http://`<GCE-EXTERNAL-IP>:
<NodePort>`
Don't forget to set firewall rules too.
(you can see why this is not the best use-case for gke)