This post covered an issue encountered by a lot of our trainees While Creating Load Balancer on Oracle Cloud Infrastructure(OCI). Also, we have covered an overview of Load Balancer in Oracle Cloud (OCI)
This blog discusses the symptoms, the root cause (502 Bad Gateway) and the fix of this prevalent issue.
Before moving into the Issue & its Fix, Lets first understand the Overview of Load Balancer
Overview Of Load Balancer In Oracle Cloud (OCI)
Load Balancer provides automated traffic distribution from one entry point to multiple servers in VCN or Load balancer automatically distributes traffic to list healthy backend servers based on
- Health Check Policy
- Load Balancing Policy
Where Health Check Policy is a test to confirm the availability of backend servers & a load balancing policy tells the load balancer how to distribute incoming traffic to the backend servers.
Type Of Load Balancer In Oracle Cloud (OCI)
1)Public Load Balancer: To accept traffic from the internet, you create a public load balancer. The service assigns it a public IP address that serves as the entry point for incoming traffic. You can associate the public IP address with a friendly DNS name through any DNS vendor.
2)Private Load Balancer: To isolate your load balancer from the internet and simplify your security posture, you can create a private load balancer. The Load Balancing service assigns it a private IP address that serves as the entry point for incoming traffic.
(Note: If you are just starting on Oracle Cloud or new to Oracle Cloud Infrastructure (OCI), then I would suggest you check our previous post on Oracle Cloud Infrastructure (OCI) which covers the basic concepts i.e. Region, AD, Tenancy, Compartment, VCN, IAM, Compute, Storage Service, etc)
To create a minimal system with a functioning load balancer, you must:
- For a public load balancer, create a VCN with an internet gateway and a public regional subnet.
- For a private load balancer, create a VCN with at least one private subnet.
- Create at least two Compute instances, each in a separate availability domain.
- Next Step, Create a load balancer.
- After that, Create a backend set with a health check policy.
- Add backend servers (Compute instances) to the backend set.
- Create a listener, with optional SSL handling.
- Update the load balancer subnet security list so it allows the intended traffic.
To know more on What Is Load Balancer In Oracle Cloud (OCI) & How To Create
Issue & Fix
Once the Load Balancer is fully configured, While testing its functionality by navigating to its Public IP address on a web browser, some of the trainees are facing below error
“502 Bad Gateway”
It could be through the number of reasons:
1) First Check, If your Compute Instance (Web servers) is Up & Running or not.
2) Check if the Httpd server is Up or not
3) Make Sure the Health of the Load Balancer Should be OK
4) The issue is also caused by there being no healthy backend servers available during the time period in which the errors occur.
Post your doubts in the comment box below!
Stay tuned for the more informative blogs!
- [Video] Oracle Cloud Infrastructure (OCI) | Compute CPU & Memory
- [Video 3 of 5] Oracle Cloud: Create VCN, Subnet, Firewall (Security List), IGW, DRG: Step By Step
- [Video] Create Oracle Autonomous Data Warehouse 18c on OCI
- [Video] How To Create Database on Oracle’s Gen2 Cloud (OCI)
- [Video 4 of 5] What Is Load Balancer In Oracle Cloud (OCI) & How To Create: Step By Step
Next Task For You
If you want to take your career to next level by becoming Oracle Certified Cloud Architect Associate even if you are a beginner then I would like to invite you to Join my FREE Masterclass on How To Become Oracle Certified Cloud Architect Associate in 8 Weeks. Click on the image below to register for FREE