Set up Kubernetes Ingress and Load Balancer with K8s NodePort
Your administrator needs to enable the AWS Application Load Balancer controller for your infrastructure before you can use Ingress.
- 1.In the DuploCloud Portal, navigate to Administrator > Infrastructure > Infrastructure_name > Settings.
- 2.In the Enable ALB Ingress Controller field, select True.
Once your service is deployed, you are ready to add and configure Kubernetes Ingress.
In this example, three Nginx services run with different paths.
The Services page
Once Services are deployed, add Ingress:
- 1.Select DevOpos -> Containers -> EKS/Native from the navigation pane.
- 2.Click the K8S Ingress tab.
- 3.Click Add. The Add Kubernetes Ingress page displays.
Add Kubernetes Ingress page
- 1.In the Add Kubernetes Ingress page, configure Ingress by clicking Add Rule. The Add Ingress Rule pane displays.
- 2.Complete the other fields on the page and click Add Rule. Add additional rules as needed.
Add Ingress Rule pane
DuploCloud Platform supports defining multiple paths in Ingress.
Continuing our previous example, we have defined an Ingress to route requests to
/path1/for testsvc1, and requests to
/path2/for testsvc2. For the third service, we have brought out own host (BYOH), example.com. In this example, the Ingress rules apply only to example.com.
Kubernetes Ingress rules
Add a load balancer listener that uses Kubernetes NodePort.
Using Kubernetes Health Check allows AWS's Application Load Balancer to determine whether your service is running properly.
- 1.In the DuploCloud Portal, navigate DevOps -> Containers -> EKS/Native.
- 2.On the Services page, select the Service name in the Name column.
- 3.Click the Load Balancers tab.
- 4.Click Configure Load Balancer. The Add Load Balancer Listener pane appears.
- 5.In the Select Type field, select K8S Node Port.
- 6.Optionally, select Set Health Check annotations for Ingress to add Kubernetes Health Checks and Probes.
- 7.Complete the other fields in the Add Load Balancer Listener and click Add.
Once Ingress is configured, you can access Services based on the rules for each DNS.
K8s Ingress Tab
curlcommands, you can see the difference in the output for each service. Configured services are accessed based on the DNS name specified in the DuploCloud Portal and the paths that you configured when you added Ingress rules.
>curl http://sample-ingress.qaapps.duplocloud.net/path1/ this is service1 >curl http://sample-ingress.qaapps.duplocloud.net/path2/ this is service2
>curl -H "Host: example.com" http://sample-ingress.qaapps.duplocloud.net/ this is service3