Expose port 80 and 443 in Google Container Engine without load balancer

I was working on a small project and struggling to expose port 80 and 443 in google container engine without load balance.

 Although, this service is powered by the Container Engine. So I chose GCE to avoid configuration issues, costs are affordable and to learn new things.

My modules are working fine and I created a service with a type LoadBalancer to provide service on ports 80 and 443. This works fine.

However, I found that LoadBalancer in a new Google Compute Engine, created for each service. This load balancer is quite expensive and is really complete for my project in one copy.

But, to cut costs, I’m looking for a way to expose ports without load balancing.

So what I’ve tried so far:

Even it did not fit for my requirement, so I tried my next steps, which could be helpful for you to meet your requirement too.

Which solution worked ?

After configuring the service for ports 80 and 443, I had to create a firewall rule to allow traffic to my instance host:

gcloud compute firewall-rules create your-name-for-this-fw-rule --allow tcp:80,tcp:443 --source-ranges=0.0.0.0/0

Doing this setup, finally, I was able to access my service via http (s): // yourexternalIp. You may also check out this article.

Avatar

About Shachindra Yadav

I, Shachindra Yadav, a Cloud Certified, DevOps and technology enthusiastic person, more passionate to learn and write blogs in my free time.

View all posts by Shachindra Yadav →