|
| 1 | +# Load balancing with Ingress |
| 2 | +Ingress is a approach provided by k8s to hook up and run a load balancer. Pls see detail in [the Ingress doc](https://kubernetes.io/docs/concepts/services-networking/ingress/). |
| 3 | + |
| 4 | +## WebLogic domains as backends of Ingress |
| 5 | + |
| 6 | +In Ingress a backend is defined as [a k8s service](https://kubernetes.io/docs/concepts/services-networking/service/), more specifically, a combination of a `serviceName` and a `servicePort`. A WebLogic domain is a backend of the load balancer. When the WebLogic operator creates a WebLogic domain, it always creates a k8s service for each WebLogic cluster in the domain. With the proper label selector defined in the generated service, the service contains all-and-only the running WebLogic server pods within the WebLogic cluster. |
| 7 | + |
| 8 | +The name of the k8s service generated for a WebLogic cluster follows the pattern '<domainUID>-cluster-<clusterName>'. For instance, if the doaminUID is 'domain1' and the cluster name is 'cluster-1', the corresponding k8s service name generated by WebLogic operator will be 'domain1-cluster-cluster-1'. |
| 9 | + |
| 10 | +The service name has the following limitation in k8s: |
| 11 | +> A DNS-1035 label must consist of lower case alphanumeric characters or '-', start with an alphabetic character, and end with an alphanumeric character (e.g. 'my-name', or 'abc-123', regex used for validation is '[a-z]([-a-z0-9]*[a-z0-9])?'). |
| 12 | +
|
| 13 | +To meet the limitation, if the domainUID or the cluster name contains some upper-case characters or `_` , in the generated service name the upper-case characters will be converted to lower-case and `_` will be converted to `-` . For instance, if the doaminUID is 'myDomain_1' and the cluster name is 'myCluster_1', the corresponding k8s service name generated by WebLogic operator will be 'mydomain-1-cluster-mycluster-1'. |
| 14 | + |
| 15 | +The service, `serviceName` and `servicePort`, of a WebLogic cluster will be used in the routing rules defined in Ingress resources and the load balancer will route traffic to the WebLogic servers within the cluster based on the rules. Note that eac traffic load, redirected by the load balancer, is not sent to the service directly, but instead, to one endpoint of the service based on its load-balancing algorithm. The load balancer depends on the k8s platform to maintain the live endpoint list of the service. |
| 16 | + |
| 17 | +## Steps to setup an Ingress load balancer |
| 18 | + |
| 19 | +1. Install the Ingress controller. |
| 20 | +After the Ingress controller is running, it monitors Ingress resources in given namespace(s) and acts accordingly. |
| 21 | + |
| 22 | +1. Install Ingress Resource(s) |
| 23 | +Ingress resources contain routing rules to one or more backends. And Ingress controller is responsible to apply the rules to the underline load balancer. |
| 24 | +There are two approaches to create the Ingress resource: |
| 25 | + 1. Use the helm chart [ingress-per-domain](kubernetes/samples/charts/ingress-per-domain). |
| 26 | + Each Ingress provider support a bunch of different annotations in Ingress resources. This helm chart allows you to define the routing rules without dealing with the detailed provider-specific annotations. Currently we support two Ingress providers: Traefik and Voyager. The limitation of the helm chart is that it only support one WebLogic cluster as the backend. |
| 27 | + |
| 28 | + 1. Create and install the Ingress yaml manually. |
| 29 | + Manually edit the Ingress yaml file and then install it to the k8s cluster. |
| 30 | + |
| 31 | +## Guide and samples for Traefik and Voyager/HAProxy |
| 32 | +Traefik and Voyager/HAProxy are both popular Ingress providers. We provide detail guide to install and configure these two Ingress providers, specially in front of WebLogic domain(s). |
| 33 | + - [Treafik guide](kubernetes/samples/charts/traefik/README.md) |
| 34 | + - [Voyager guide](kubernetes/samples/charts/voyager/README.md) |
| 35 | + |
| 36 | +We also provide Ingress samples for these two Ingress providers, with multiple WebLogic clusters as the backends and covering different routing rules, host-routing and path-routing, and TLS termination. |
| 37 | +- [Treafik samples](kubernetes/samples/charts/traefik/samples) |
| 38 | +- [Voyager samples](kubernetes/samples/charts/voyager/samples) |
| 39 | + |
| 40 | + |
| 41 | + |
0 commit comments